fork(3) download
  1. # http://c...content-available-to-author-only...e.com/a/85414/34718
  2.  
  3. L=[1]
  4. i=0
  5. n=input()
  6. while len(L)<3*n:L+=[2*L[i]+1,3*L[i]-1];i+=1
  7. print sorted(set(L))[n]
Success #stdin #stdout 1.94s 9080KB
stdin
500000
stdout
50241992