Created
October 22, 2017 22:36
-
-
Save jeyziel/711e7d21df29501c7ee9d576fa49f795 to your computer and use it in GitHub Desktop.
filtrar apenas os números que sejam resultado de uma raíz cúbica onde o radicando seja ímpar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pow = ( y ) => ( x ) => Math.pow( x, y ) | |
const cube = pow(3) | |
const NOT = ( x ) => !x | |
const isDivisibleBy = ( y ) => ( x ) => NOT( x % y ) | |
const isEven = isDivisibleBy(2) | |
const isOdd = ( x ) => NOT( isEven( x ) ) | |
const N = [1,2,3,4,5,6,7,8,9,10] | |
const radicandoIsOdd = ( x ) => isOdd( cube( x ) ) | |
const filterRadicando = N.filter( radicandoIsOdd ) | |
console.log( filterRadicando ) //[ 1, 3, 5, 7, 9 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment