diff options
Diffstat (limited to 'challenge-116/stuart-little/node/ch-2.js')
| -rwxr-xr-x | challenge-116/stuart-little/node/ch-2.js | 6 |
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)) |
