about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/2/6.js
blob: 52cb82a0c84341ea12954710e91db58052aa7613 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
const A039943 = [0, 1, 4, 16, 20, 37, 42, 58, 89, 145];  // OEIS

for (i = j = 1; i < 11; ++j) {
    for (k = j;
         !A039943.includes(k);
         k = k.toString().split('').map(n => n*n).reduce((m, n) => m+n));
    if (k == 1) {
        console.log(j);
        i++;
    }
}