Wireless Army
This is a blog / tips and tricks website for web developers and security researchers.
follow us in feedly


finding Fibonacci numbers
by admin
 at 2016-06-27 07:21:00.

assuming that you have python installed (version 3 is not recommended for this script) past this code is a file with the extension of .py then run it. It will ask you for a number, you need to choose a max limit to count to for your Fibonacci numbers and it will give you all the Fibonacci numbers in a file. if you put a large number you can find a visual patter.
def fib():
	x,y = 0,1
	while True:
		yield x
		x, y = y, x + y
a = int(raw_input('Enter a number: '))
fi = fib().next
while fi() <= a:
		f = open('fibonacci.txt','a')
		f.write(str(str(fi()).split()).strip("[]"))
		f.close()