#!/bin/bash maxint=9223372036854775807 root=3037000499 found=0 rm -f fibonacci.list SECONDS=0 destination=1099511627775 n=1 l=1 t=0 echo "0000000001 1" >> fibonacci.list while [[ $n -le $destination ]] && [[ $n -gt 0 ]]; do t=$((l+n)) l=$n n=$t if [[ $n -le $destination ]]; then clear ((found++)) hex=$(printf "%010X" "$n") echo "Number $n of $destination is FIBONACCI [$((n*100/destination)) %]" echo "$hex $n" >> fibonacci.list rate=$((SECONDS*1000000/n)) estsec=$((rate*destination/1000000)) remsec=$((estsec-SECONDS)) echo "Running Time: $((SECONDS/86400)) days, $(((SECONDS%86400)/3600)) hours, $(((SECONDS%3600)/60)) minutes and $(((SECONDS%60))) seconds..." echo "Remaining Time: $((remsec/86400)) days, $(((remsec%86400)/3600)) hours, $(((remsec%3600)/60)) minutes and $(((remsec%60))) seconds..." echo "Found $found FIBONACCI numbers at an average rate of $((found/(SECONDS+1))) per second..." fi done