The content below can be saved as python file fhSeries.py Note: This is a modified version of Python script in the documentation ------------------------------------------------------------------------- def fib(n): # write Fibonacci/Hemachandra series up to n """Print a Fibonacci series up to n.""" idx=0 a, b = 0, 1 while a < n: idx +=1 print(' [',idx,']', a, '\n', end='') a, b = b, a+b print() print('\n','Fibonacci/Hemachandra Sequence < 1000','\n') fib(1000) Note: This sequence was first formulated by a Indian Mathematician Pingala
4798