> А 100-е число Фибоначи также можешь? :)
лови:)
$ echo 0010011 | sed 's/\(.\)/\1@/g' | tr @ \\n | awk -vc='1 0 1' -vm='0 1 1' '{ split(m,a); split(c,b) } $1>0 { $1="(" b[1] "*" a[1] "+" b[2] "*" a[2] ")"; $2="(" b[1] "*" a[2] "+" b[2] "*" a[3] ")"; $3="(" b[2] "*" a[2] "+" b[3] "*" a[3] ")"; c=$0 } { $1="(" a[1] "*" a[1] "+" a[2] "*" a[2] ")"; $2="(" a[1] "+" a[3] ")*" a[2]; $3="(" a[2] "*" a[2] "+" a[3] "*" a[3] ")"; m=$0 } END { split(c,b); print b[2] }' | bc
354224848179261915075