MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/funny/comments/utfkw/pidgonacci_sequence/c4yp0py/?context=3
r/funny • u/[deleted] • Jun 09 '12
[deleted] — view deleted post
22k comments sorted by
View all comments
Show parent comment
3
For anyone interested, this is what I'm using:
import os import sys
def fibonacci(a, b): a += b return (b, a)
def format_fibonacci(iteration, value): return 'F(%d) = %d' % (iteration, value)
def mane(): a, b, iteration = 0, 1, 1 start = int(raw_input('Enter the number you want to start with: '))
while (a < start): iteration += 1 a, b = fibonacci(a, b) print '\n%s' % format_fibonacci(iteration, b)
if a != start: print 'Uh oh, your start number is not a Fibonacci number!' sys.exit()
while (True): iteration += 1 a, b = fibonacci(a, b) output = format_fibonacci(iteration, b)
print '\n%s' % output os.system('echo "%s" | pbcopy' % output) raw_input('Press Enter to continue...')
mane()
1 u/awkisopen Jun 10 '12 Typing fibonacci(n) into Wolfram|Alpha also works. 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, it does, but his method is probably quicker and cleaner. 1 u/awkisopen Jun 10 '12 Quicker and cleaner than requesting a webpage? 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, he's just using a script, some people had it figured out so well they needed only to hit enter and the entire thing would be copied on their clipboard 1 u/awkisopen Jun 10 '12 I suppose something that copies to clipboard would be nice. 1 u/Craftable64 Jun 10 '12 In Mathematica, this is all I need to do:Manipulate[Fibonacci[n], {n, 1, 10000, 1}] 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, only most of us don't have mathematica. 1 u/Obi_wan_The_cannoli Jun 10 '12 How do you use this?
1
Typing fibonacci(n) into Wolfram|Alpha also works.
1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, it does, but his method is probably quicker and cleaner. 1 u/awkisopen Jun 10 '12 Quicker and cleaner than requesting a webpage? 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, he's just using a script, some people had it figured out so well they needed only to hit enter and the entire thing would be copied on their clipboard 1 u/awkisopen Jun 10 '12 I suppose something that copies to clipboard would be nice. 1 u/Craftable64 Jun 10 '12 In Mathematica, this is all I need to do:Manipulate[Fibonacci[n], {n, 1, 10000, 1}] 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, only most of us don't have mathematica.
Yes, it does, but his method is probably quicker and cleaner.
1 u/awkisopen Jun 10 '12 Quicker and cleaner than requesting a webpage? 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, he's just using a script, some people had it figured out so well they needed only to hit enter and the entire thing would be copied on their clipboard 1 u/awkisopen Jun 10 '12 I suppose something that copies to clipboard would be nice. 1 u/Craftable64 Jun 10 '12 In Mathematica, this is all I need to do:Manipulate[Fibonacci[n], {n, 1, 10000, 1}] 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, only most of us don't have mathematica.
Quicker and cleaner than requesting a webpage?
1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, he's just using a script, some people had it figured out so well they needed only to hit enter and the entire thing would be copied on their clipboard 1 u/awkisopen Jun 10 '12 I suppose something that copies to clipboard would be nice. 1 u/Craftable64 Jun 10 '12 In Mathematica, this is all I need to do:Manipulate[Fibonacci[n], {n, 1, 10000, 1}] 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, only most of us don't have mathematica.
Yes, he's just using a script, some people had it figured out so well they needed only to hit enter and the entire thing would be copied on their clipboard
1 u/awkisopen Jun 10 '12 I suppose something that copies to clipboard would be nice. 1 u/Craftable64 Jun 10 '12 In Mathematica, this is all I need to do:Manipulate[Fibonacci[n], {n, 1, 10000, 1}] 1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, only most of us don't have mathematica.
I suppose something that copies to clipboard would be nice.
In Mathematica, this is all I need to do:
Manipulate[Fibonacci[n], {n, 1, 10000, 1}]
1 u/Obi_wan_The_cannoli Jun 10 '12 Yes, only most of us don't have mathematica.
Yes, only most of us don't have mathematica.
How do you use this?
View all comments
Show parent comment
3
u/Therianthrope Jun 10 '12
For anyone interested, this is what I'm using:
import os import sys
def fibonacci(a, b): a += b return (b, a)
def format_fibonacci(iteration, value): return 'F(%d) = %d' % (iteration, value)
def mane(): a, b, iteration = 0, 1, 1 start = int(raw_input('Enter the number you want to start with: '))
while (a < start): iteration += 1 a, b = fibonacci(a, b) print '\n%s' % format_fibonacci(iteration, b)
if a != start: print 'Uh oh, your start number is not a Fibonacci number!' sys.exit()
while (True): iteration += 1 a, b = fibonacci(a, b) output = format_fibonacci(iteration, b)
mane()