2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,36 @@
(() => {
// nonSquare :: Int -> Int
let nonSquare = n =>
n + floor(1 / 2 + sqrt(n));
// floor :: Num -> Int
let floor = Math.floor,
// sqrt :: Num -> Num
sqrt = Math.sqrt,
// isSquare :: Int -> Bool
isSquare = n => {
let root = sqrt(n);
return root === floor(root);
};
// TEST
return {
first22: Array.from({
length: 22
}, (_, i) => nonSquare(i + 1)),
firstMillionNotSquare: Array.from({
length: 10E6
}, (_, i) => nonSquare(i + 1))
.filter(isSquare)
.length === 0
};
})();

View file

@ -0,0 +1,5 @@
{
"first22":[2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15,
17, 18, 19, 20, 21, 22, 23, 24, 26, 27],
"firstMillionNotSquare":true
}