summaryrefslogtreecommitdiff
path: root/fib.awk
diff options
context:
space:
mode:
authorwukong <wukong@longaeva>2018-09-30 00:53:52 -0700
committerwukong <wukong@longaeva>2018-09-30 00:53:52 -0700
commit6375b4618439865e2c975aaa5bb30623e9082df3 (patch)
tree7b01f8e917169e3aee1d73fc888b497d32a41e32 /fib.awk
parentd1f6c89be163d9399d569e01458242d8ce15e041 (diff)
added fib.awk, a solution to fib eqn (example in Hamming text);
removed pi.sh (redundant); added corrections to quad_reg
Diffstat (limited to 'fib.awk')
-rw-r--r--fib.awk10
1 files changed, 10 insertions, 0 deletions
diff --git a/fib.awk b/fib.awk
new file mode 100644
index 0000000..6107c4c
--- /dev/null
+++ b/fib.awk
@@ -0,0 +1,10 @@
+#!/usr/bin/awk -f
+
+### fib.awk
+# fib sol'n from Hamming
+
+BEGIN {
+ n = ARGV[1]
+ printf(OFMT ORS,
+ (1/sqrt(5))*((1.0 + sqrt(5))/2.0)^n - (1/sqrt(5))*((1.0 - sqrt(5))/2.0)^n)
+}