aboutsummaryrefslogtreecommitdiff
path: root/challenge-112/abigail/node/ch-2.js
blob: 2c06c8fdcde0eec75cf5a1bce67d3bc6285f4721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
))