fork download
  1. def p():
  2. q,r,t,j = 1,180,60,2
  3. while True:
  4. u,y = 3*(3*j+1)*(3*j+2),(q*(27*j-12)+5*r)//(5*t)
  5. yield y
  6. q,r,t,j = 10*q*j*(2*j-1),10*u*(q*(5*j-2)+r-y*t),t*u,j+1
  7. p=p()
  8.  
  9. LIM = 5000
  10.  
  11. d=L = [p.next()]
  12. #print 0,
  13. print 3
  14.  
  15. n=1
  16. while n<LIM:
  17. x = p.next()
  18. if d[-1]==x:
  19. d.append(x)
  20. if len(d)>len(L):
  21. #print n,
  22. print "".join(str(i)for i in d)
  23. L.append(long("".join(str(i)for i in d)))
  24. else:
  25. d=[x]
  26. n += 1
  27.  
  28. #print
  29. #for i in L:print str(i),
  30. #print
Success #stdin #stdout 1.2s 9072KB
stdin
Standard input is empty
stdout
3
33
111
9999
99999
999999