fork download
  1. import itertools
  2.  
  3. def fibonacci(n):
  4. a, b = 1, 1
  5. yield a
  6. for _ in range(1, n):
  7. a, b = b, a+b
  8. yield a
  9.  
  10. def nth_value(n):
  11. return next(itertools.islice(fibonacci(n), n-1, n))
  12.  
  13. print(nth_value(1500))
Success #stdin #stdout 0s 23304KB
stdin
Standard input is empty
stdout
13551125668563101951636936867148408377786010712418497242133543153221487310873528750612259354035717265300373778814347320257699257082356550045349914102924249595997483982228699287527241931811325095099642447621242200209254439920196960465321438498305345893378932585393381539093549479296194800838145996187122583354898000