Sieve of Erathostenes in Brainf*ck

I got really into esoteric languages at some point, which culminated in me writing the Sieve of Erathostenes in Brainf*ck, a programming language with only 8 commands. Run the code here or view on GitHub.

The GitHub README says “I wrote this in the summer of 2014 when I was bored on holiday. The whole thing was written from my phone.” Weird flex, teenage me.

The program prints primes up to N, which it reads from input (terminated by 0). Memory cells are divided into groups of five, each group represents one number. Each cell of the group has a certain function:

  1. The number itself
  2. Number of divisors of this number minus 2. This value is 0 for primes and more for composite numbers
  3. Whether the number is in range from 1 to N, 1 if yes, 0 if no
  4. Temporary value
  5. Temporary value
>>>>>>>>>>>>>
Print "Enter a number:" and read input
+++++++++++[->++++++>++++++++++>+++++++++>+++<<<<]>+++.>.++++
++.>++.<--.>>-.<----.>.<<----.+++++++.--------.>+.+++.<+++++.
<-----------.>>>.[-]<[-]<[-]<[-]+[[-]>[-],[+[-----------[>[-]
++++++[-<------>]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]<
Initialization
[->+>+<<]>>[-<<+>>]<-
[<<+>
    [->>>>+>+<<<<<]
    >>>>[-<<<<+>>>>]<<<
    [->>>>>+<<<<<]>>>>>-
]<<+>
Assign numbers to the groups
[-<<<+>>>]<<<-
[+<<[-]>>[-<+<<<<+>>>>>]<[->+<]<<<<--]

>>->>>
>>[
<[->>+>+<<<]>>>[-<<<+>>>]+<
[[-]>[-]<]
>[[-]
Copy data from current number
Moving to the "index" cell in the group
<<<<
[->+>>+>+<<<<]>[-<+>]>
[>
    [ We haven't jumped enough
        [->>>>>+<<<<<]>>>>>-<<<<<
        >[->>>>>+<<<<<]<<->
    ]<[ Mark as composite
        <+>->>[-<+<+>>]<<[->>+<<]>
        [->>>>>+<<<<<]>>>>>-<<<<<
        >[->>>>>+<<<<<]<
        <
    ]
    [-]+>>>>>
]
Go back
>[->-<]>+[[-<<<<<+>>>>>]<<<<<-]
<<[<<<<<]>>>>>>>]
<<
Go to next number
[-]>>>>>
]<<
Output (printing ASCII as numbers adapted from elsewhere)
<<<<<[<<<<<]>>>>>
[>>[-]+<[[-]>-<]>[
<<
<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]++++++++++.[-] Newline before the number
>>>>>>>
++++++++++>>[-<+<-[<+<<]<[+[->+<]<+<<]>>>>>>]<<[-]<<<++++++++++>[-<-[<+<<]<[+[- >+<]<+<<]>>>>>]<[-]<<[<++++++[->++++++++<]>.>>+<+<[-]]>[>[-<->]++++++[-<++++++++>]<.[-]]>>++++++[->++++++++<]>.[-]>>[->+<]>
>
>-]
>>>]

Updated: