squaresums.bf 818 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Justice Suh
  2. cell #0 = 100
  3. ++++++++++[>++++++++++<-]>[<+>-]<
  4. cell #2 = sum of 1 to 100
  5. [[>+>+<<-]>>[<<+>>-]<[>>+<<-]<-]>>>[<+>-]<
  6. cell #3 = cell #2
  7. [>+>+<<-]>>[<<+>>-]<
  8. cell #0 = cell #2 * cell #3
  9. [<[<+<+>>-]<[>+<-]>>-]<[-]
  10. cell #2 = 100
  11. ++++++++++[>++++++++++<-]>[<+>-]<
  12. loop until cell #2 = 0
  13. [
  14. cell #4 = cell #3 = cell #2
  15. [>+>+>+<<<-]>>>[<<<+>>>-]<<
  16. add cell #3 * cell #4 to cell #1
  17. [>[>+<<<<+>>>-]>[<+>-]<<-]>[-]<
  18. <-
  19. ]
  20. cell #0 = cell #0 minus cell #1
  21. <[<->-]<
  22. cell #2 = cell #0
  23. [>>+>+<<<-]>>>[<<<+>>>-]<<+>
  24. loop while value exists
  25. [<->[
  26. divide by ten
  27. >++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]
  28. ascii offset
  29. ++++++++[<++++++>-]
  30. store remainder
  31. >[<<+>>-]>[<<+>>-]<<
  32. ]>]
  33. make zero
  34. <[->>++++++++[<++++++>-]]
  35. output in reverse order
  36. <[.[-]<]++++++++++.[-]<