fork download
  1. ** set initial value and input n
  2. ** memory layout: nct_ab___ab____*
  3. ** a:fib(0) b:fib(1) *:terminater minus 1
  4. *-<<<<<b<<<<<b+<<<<
  5. c,+[
  6. >t+++++++[-<c------->t]
  7. t<<n[->c++++++++++<n]
  8. n>c[-<n+>c]
  9. c,+]
  10.  
  11. ** memory layout:
  12. * Nn___ab___ab ~ __ab____*
  13. * N___AB____ab ~ __ab____*
  14. * N___ABdr__ab ~ __ab____*
  15. * N___AB___AB_ ~ _AB______
  16. <n-[n
  17. * move n to N ( next n )
  18. n-[-<N+>n]
  19. * digit loop
  20. n->>>>>b+[b-
  21. * move b to A ( next a ) and add to a=B ( next b )
  22. b[-<aB+<A+>>b]
  23. * divmod by 10 ( add quotient to the right a )
  24. bd++++++++++
  25. <B[->d-[d>r+>_]>r_?[r+[-<d+>r]>>>a+<_]<<<<B]
  26. * clear d and move r to B
  27. >d[-]>r[-<<B+>>r]
  28. >>>>b ( slide )+]
  29. * judge if extend digit or not
  30. <<<<<<b[>>>>>]>>>>>-<+[-<+]n
  31. <Nn]
  32. * set terminater ( minus 1 ) to n
  33. ->+[->+]
  34. * skip the highest digit ( 0 )
  35. <<<<<<<<<<b
  36. ** output loop
  37. ** memory layout: *___ab___ab ~ _ab___abt
  38. b+[b-
  39. >t++++++[-<b++++++++>t]<b.
  40. <<<<<b+]
Success #stdin #stdout 0.01s 5284KB
stdin
100
stdout
354224848179261915075