diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-05-12 09:31:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-12 09:31:36 +0100 |
| commit | f9cc77c8dcd87a9b530814b96b41c9c187d8214b (patch) | |
| tree | 26322ea6c4bf7f962529510bd82f31e27bc02f59 /challenge-112/abigail/lua/ch-2.lua | |
| parent | 56dff1e5a018f8d2ca229494d30d56294c677a40 (diff) | |
| parent | 7545df1494144c724111ae198f7ba8caae9e3e03 (diff) | |
| download | perlweeklychallenge-club-f9cc77c8dcd87a9b530814b96b41c9c187d8214b.tar.gz perlweeklychallenge-club-f9cc77c8dcd87a9b530814b96b41c9c187d8214b.tar.bz2 perlweeklychallenge-club-f9cc77c8dcd87a9b530814b96b41c9c187d8214b.zip | |
Merge pull request #4067 from Abigail/abigail/week-112
Abigail/week 112
Diffstat (limited to 'challenge-112/abigail/lua/ch-2.lua')
| -rw-r--r-- | challenge-112/abigail/lua/ch-2.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-112/abigail/lua/ch-2.lua b/challenge-112/abigail/lua/ch-2.lua new file mode 100644 index 0000000000..8932952bbd --- /dev/null +++ b/challenge-112/abigail/lua/ch-2.lua @@ -0,0 +1,16 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-2.lua < input-file +-- + +local SQRT5 = math . sqrt (5) +local PHI = (1 + SQRT5) / 2 + +for line in io . lines () do + print (math . floor (0.5 + PHI ^ (tonumber (line) + 1) / SQRT5)) +end |
