Bash Fibonacci Sequence Generator
Page 1 of 1
Bash Fibonacci Sequence Generator
Bash Fibonacci Sequence Generator
https://app.box.com/s/cx77cvrdk90ae5nzk8meq8yf9bkj9lku
Example 1
https://app.box.com/s/cx77cvrdk90ae5nzk8meq8yf9bkj9lku
Example 1
- Code:
#!/bin/bash
# (c) J~Net 2021
# jnet.sytes.net
#
# ./fib.sh 999999999999999999999999999999999999999999999999"
#
#
longnumber="999999999999999999999999999999999999999999999999"
#
echo "Max Lengh "
echo -n "$longnumber" | wc -c
#
echo "Welcome To Fibinatchi By (c) J~Net 2021"
if [ "$#" -eq "0" ]
then
echo "Enter Max Number For Example"
echo "$longnumber"
echo ""
read term
else
term=$1
fi
#
i=0
j=1
for ((i=1; i<term/2+1; i++)) ; do
(( n=i+j ))
(( i=j ))
(( j=n ))
echo $i
done
Last edited by jamied_uk on 4th March 2022, 12:30; edited 1 time in total
Re: Bash Fibonacci Sequence Generator
Example 2
- Code:
#!/bin/bash
# (c) J~Net 2022
# jnet.sytes.net
#
# https://jnet.forumotion.com/t1070-bash-fibonacci-sequence-generator#1429
#
#
# ./fib2.sh 999999999999999999999999999999999999999999999999"
#
set -e
#clear
f1=0;f2=1 # 0 1
f3=`expr $f1 + $f2`
if [ "$#" -eq "0" ]
then
echo "Max Lengh "
read n
else
n=$1
fi
i=3
while [ $i -le $n ]
do
echo $f3
f1=$f2
f2=$f3
f3=`expr $f1 + $f2`
i=`expr $i + 1`
done
set +e
Re: Bash Fibonacci Sequence Generator
your job is to find out how accurate it is and make it more accuate
then make it it go indefenatly forever finding new long numbers without getting errors while keeping it accurate!
Post your code below!
then make it it go indefenatly forever finding new long numbers without getting errors while keeping it accurate!
Post your code below!
Similar topics
» Linux Bash 1000 Prime Number Generator
» Bash Psychic Game For Linux Bash
» Custom Shift Cypher Generator
» Switching Shells from zsh crap to standard good old bash (/bin/bash)
» Basic Bash Talking AI Example
» Bash Psychic Game For Linux Bash
» Custom Shift Cypher Generator
» Switching Shells from zsh crap to standard good old bash (/bin/bash)
» Basic Bash Talking AI Example
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum