aboutsummaryrefslogtreecommitdiff
path: root/challenge-112/abigail/node/ch-2.js
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-112/abigail/node/ch-2.js')
-rw-r--r--challenge-112/abigail/node/ch-2.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-112/abigail/node/ch-2.js b/challenge-112/abigail/node/ch-2.js
new file mode 100644
index 0000000000..2c06c8fdcd
--- /dev/null
+++ b/challenge-112/abigail/node/ch-2.js
@@ -0,0 +1,18 @@
+#!/usr/local/bin/node
+
+//
+// See ../README.md
+//
+
+//
+// Run as: node ch-2.js < input-file
+//
+
+let SQRT5 = Math . sqrt (5)
+let PHI = (1 + SQRT5) / 2
+
+ require ('readline')
+. createInterface ({input: process . stdin})
+. on ('line', _ => console . log (
+ Math . round (Math . pow (PHI, +_ + 1) / SQRT5)
+))