I hereby claim:
- I am farskid on github.
- I am farskid (https://keybase.io/farskid) on keybase.
- I have a public key ASDf3J3qhJ_y_QkaxGwL65icVgcJz4divVFQFf8VT58Qxgo
To claim this, I am signing this object:
function sieveOfAtkin(limit){ | |
var limitSqrt = Math.sqrt(limit); | |
var sieve = []; | |
var n; | |
//prime start from 2, and 3 | |
sieve[2] = true; | |
sieve[3] = true; | |
for (var x = 1; x <= limitSqrt; x++) { |
I hereby claim:
To claim this, I am signing this object:
function gcd(n, m) { | |
if (!m) { return n; } | |
return (m, n % m); | |
} | |
console.log(gcd(512, 1024)); // 256 |
function recursiveRange(a, b) { | |
if (a + 1 === b) { | |
return []; | |
} | |
return [a + 1].concat(range(a + 1, b)); | |
} |
function sumOfIntArray(array) { | |
if (!array.length) { | |
return 0; | |
} | |
return array.pop() + sumOfIntArray(array); | |
} |
function expo(num, power) { | |
if (power === 1) return num; | |
return num * expo(num, power - 1); | |
} |
function fibo(n) { | |
if (n === 1) return 0; | |
if (n === 2) return 1; | |
return fibo(n - 1) + fibo(n - 2); | |
} | |
function fiboLogger(n) { | |
if (n === 0) return []; | |
return [fibo(n)].concat(fiboLogger(n-1)); | |
} |
function sortAsc(array) { | |
if (!array.length) { | |
return []; | |
} | |
return array.splice( | |
array.indexOf( | |
Math.min.apply(null, array) | |
), 1) | |
.concat(sortAsc(array)); | |
} |
function flattenArray(array) { | |
let result = []; | |
array.forEach(function(item, i) { | |
if (Array.isArray(item)) { | |
result = result.concat(flattenArray(array[i])); | |
} | |
else { | |
result = result.concat([item]); | |
} | |
}); |