Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,4 @@
for (let i of [...Array(5000).keys()]
.filter(n => n == n.toString().split('')
.reduce((a, b) => a+Math.pow(parseInt(b),parseInt(b)), 0)))
console.log(i);

View file

@ -0,0 +1,32 @@
(() => {
'use strict';
const main = () =>
filter(isMunchausen, enumFromTo(1, 5000));
// isMunchausen :: Int -> Bool
const isMunchausen = n =>
n.toString()
.split('')
.reduce(
(a, c) => (
d => a + Math.pow(d, d)
)(parseInt(c, 10)),
0
) === n;
// GENERIC ---------------------------
// enumFromTo :: Int -> Int -> [Int]
const enumFromTo = (m, n) =>
Array.from({
length: 1 + n - m
}, (_, i) => m + i);
// filter :: (a -> Bool) -> [a] -> [a]
const filter = (f, xs) => xs.filter(f);
// MAIN ---
return main();
})();

View file

@ -0,0 +1 @@
[1, 3435]