04-11-2014, 03:49 PM
(This post was last modified: 04-11-2014, 04:05 PM by qwerasd205.)
So it's a fib sequence counter.
btw in case you wanted to know the 1000th fib sequence number:
"43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875"
Now for the code:
and that's it xD
EDIT: revised code with labeling and eliminates n3:
9001st fibonacci:
560099116857419990464943760131738213410973574450557569045176277317822939235205889847949348806304754949278198262172298679574779297161320064939750877571313229378221575703940626150228439349326844513851927463723955237446597282275096520469634800231063864188155519959004568780983883593105357198392172284293269487320491833861266308399371327696698447899888400356574148775600076153447061861327527440584033178844105541588185668504556952741081485373244865058979409901355133413012818559073505121293839049046825377352178213218516964697425159896192972280120974245144761842723070903122738253183331897068595992547070141556418397382375060567242575538813068672080110283183002890240755687530942784964760570016956150052341059990556659328616029808803614308992648989681753767230588853838254552288069736573800942160210638813614154121306378682894407574069653207240176609682089123169509386337654417370839812009824633889721963803284321598773522232298860383031840634823339047077980418827154084382134816077040846187007029100525225050411009628112893973940306163099594091684782251212407706428901440658234672671847511284395140130231963528229763446863604309308741739055074187039321096756599929637964218643340665936564726624761980140760894254342275971799732086854574199502772675135827932516546254945641296103715739922978086817787826932423283473166088163144527187673348745574685611576129352756991242194682242235344654822077940834629486759964315191762582992241766782047513771480255336026822877570203431595955451355220286779101502725771727063258768674327436410642725592705632943547457439584403099387525913543920938096654576444065751992162827736240140321064859389065030629677606907206292761054008433597681578671142030125729147906481435883380202596703751455556329500441498768660641059849926080739181883790010598131050919274599700925111720354423730407105203242432257433867006577759151745760167318600853713004609154694001
btw in case you wanted to know the 1000th fib sequence number:
"43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875"
Now for the code:
Code:
n1=1
n2=1
n3=0
i=2
print("How many iterations should the loop go?")
inp=input()
print("1\n1")
while(i<int(inp)):
n3=n1
n1=n1+n2
n2=n3
print(n1)
i=i+1
EDIT: revised code with labeling and eliminates n3:
Code:
n1=1
n2=1
i=2
print("How many iterations should the loop go?")
inp=input()
print("1| 1\n2| 1")
while(i<int(inp)):
n2, n1 = n1, n1+n2
print(str(i+1)+"| "+str(n1))
i=i+1
9001st fibonacci:
560099116857419990464943760131738213410973574450557569045176277317822939235205889847949348806304754949278198262172298679574779297161320064939750877571313229378221575703940626150228439349326844513851927463723955237446597282275096520469634800231063864188155519959004568780983883593105357198392172284293269487320491833861266308399371327696698447899888400356574148775600076153447061861327527440584033178844105541588185668504556952741081485373244865058979409901355133413012818559073505121293839049046825377352178213218516964697425159896192972280120974245144761842723070903122738253183331897068595992547070141556418397382375060567242575538813068672080110283183002890240755687530942784964760570016956150052341059990556659328616029808803614308992648989681753767230588853838254552288069736573800942160210638813614154121306378682894407574069653207240176609682089123169509386337654417370839812009824633889721963803284321598773522232298860383031840634823339047077980418827154084382134816077040846187007029100525225050411009628112893973940306163099594091684782251212407706428901440658234672671847511284395140130231963528229763446863604309308741739055074187039321096756599929637964218643340665936564726624761980140760894254342275971799732086854574199502772675135827932516546254945641296103715739922978086817787826932423283473166088163144527187673348745574685611576129352756991242194682242235344654822077940834629486759964315191762582992241766782047513771480255336026822877570203431595955451355220286779101502725771727063258768674327436410642725592705632943547457439584403099387525913543920938096654576444065751992162827736240140321064859389065030629677606907206292761054008433597681578671142030125729147906481435883380202596703751455556329500441498768660641059849926080739181883790010598131050919274599700925111720354423730407105203242432257433867006577759151745760167318600853713004609154694001
This is my signature.