From 8644699f4d2fce12a41289f9627bc45be9dd1965 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Thu, 3 Dec 2020 09:32:13 +0700 Subject: [usth/ICT3.2] Develop web applications --- usth/ICT3.2/prac/2/6.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 usth/ICT3.2/prac/2/6.js (limited to 'usth/ICT3.2/prac/2/6.js') diff --git a/usth/ICT3.2/prac/2/6.js b/usth/ICT3.2/prac/2/6.js new file mode 100644 index 0000000..52cb82a --- /dev/null +++ b/usth/ICT3.2/prac/2/6.js @@ -0,0 +1,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++; + } +} -- cgit 1.4.1