aboutsummaryrefslogtreecommitdiff
path: root/challenge-116/stuart-little/node/ch-2.js
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-06-08 15:38:14 +0100
committerGitHub <noreply@github.com>2021-06-08 15:38:14 +0100
commit044b240256b60ea2e966bb578ec26ea60bd4452f (patch)
treebdad65aed577c53a20f98b31efa5cc3f3169ab98 /challenge-116/stuart-little/node/ch-2.js
parent4e8cfbc7fd03a526e49e2af7af2b8a8b4acfdf48 (diff)
parent17ae968a18571df8021c1726201d69a025cb98d7 (diff)
downloadperlweeklychallenge-club-044b240256b60ea2e966bb578ec26ea60bd4452f.tar.gz
perlweeklychallenge-club-044b240256b60ea2e966bb578ec26ea60bd4452f.tar.bz2
perlweeklychallenge-club-044b240256b60ea2e966bb578ec26ea60bd4452f.zip
Merge pull request #4220 from stuart-little/stuart-little_116_node
1st commit on 116_node
Diffstat (limited to 'challenge-116/stuart-little/node/ch-2.js')
-rwxr-xr-xchallenge-116/stuart-little/node/ch-2.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/challenge-116/stuart-little/node/ch-2.js b/challenge-116/stuart-little/node/ch-2.js
new file mode 100755
index 0000000000..8eef71f6d7
--- /dev/null
+++ b/challenge-116/stuart-little/node/ch-2.js
@@ -0,0 +1,6 @@
+#!/usr/bin/env node
+
+// run <script> <number>
+
+const digSqSum=process.argv[2].split('').map(x => parseInt(x) ** 2).reduce((x,y) => x+y)
+console.log(0+(Math.floor(Math.sqrt(digSqSum)) ** 2 == digSqSum))