• Source
    1. ** input L and initialize **
    2. ,----------[<[->++++++++++<]++++++[->------<]>-->,----------]
    3. ->>>++>>>+>>>-<+[-<+]-<
    4. ****
    5. * memory layout: C*__p__q__p__q ~~ p__q__*
    6. * C: counter ( initially L )
    7. * p q: decimal digit ( low: left )
    8. * *: sentinel ( minus 1 )
    9. ****
    10. ** main loop **
    11. [+[---
    12. ** add p to q ( Q ) and expand a digit **
    13. * C*____pQ____pQ ~~ _00_____*
    14. >>>->+[-
    15. [->>+>+<<<]>>>>>>
    16. +]>>>>>>,+>>>-
    17. ** add carry to the next Q's digit ( with simple divmod ) and add q back to p ( P ) **
    18. * C*____Pq____Pq ~~ _Pq____*
    19. * pQ____pQ
    20. * p__m__pQ'
    21. * Pq____pQ' ( add m to p and also move m to q )
    22. **
    23. <+[-<+]>>->>+[-
    24. >++++++++++<[->-[>+>]>[,+>>>>+<<]<<<<]
    25. >,+>[-<<+<+>>>]>>>>
    26. +]<-
    27. ** add carry to the next P's digit ( with simple divmod ) **
    28. * C*__p__q__p__q ~~ p__q__*
    29. <+[-<+]>+[-
    30. <++++++++++>[-<-[<+<]<[,+>>>>>>>>+<<<<<<<<<<]>>>>]
    31. <,+>>>>>>>
    32. +]<<,
    33. ** shrink digit when the p's highest digit is zero **
    34. <<<<<+<[>-]>[-<-<]
    35. +[-<+]-<
    36. <<]>>]
    37. >+[-<+]-
    38. ** q: MP decrement **
    39. >>>>>+[
    40. >[-<-]
    41. <[->+++++++++>>>>>+<]
    42. >]
    43. ** search the Q's highest ( non zero ) digit **
    44. +[->+]<<+<[>-]>[<<<<<]<+<+[->-]>[-<->>>>>>>>]<<
    45. ** print **
    46. +[
    47. <++++++[->++++++++<]>-.
    48. <<<<<<+]