Magical BF 2
Time limit1sMemory limit1024 MB
Write an N by N BF grid that leaves x mod 7 in cell M0 for input x up to 200, whether the grid is read by rows or by columns.
- Level
Hard8 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
At school, John learned that many East Asian languages can be written from left to right or from top to bottom. He especially wanted to know whether a text can be written so that it reads correctly both ways. In programming class that question kept coming back, so now he wants code that solves the tasks when read by rows (top to bottom, left to right) and when read by columns (left to right, top to bottom). He picked BF as the language for his experiments.
The memory of a BF program is an infinite array with cells numbered from left to right, , , \ldots. Each cell holds a nonnegative integer that can grow arbitrarily large. At the start, the data pointer points to the leftmost cell .
Execution starts at the first command. After most commands, the program moves on to the next command in the sequence. There are six commands, each denoted by one character.
Submit each solution as an grid of BF code, where . The code does not have to be the same when read by rows and by columns, but it must solve the task correctly in both cases. The solution can only contain the characters '>', '<', '+', '-', '[', and ']', and it must completely fill the grid. For any allowed input, the code must not execute more than 10 million commands.
Task: The cell contains an integer (), and all other cells contain zeros. Write the remainder of dividing by into the cell . When execution ends, cells other than may contain any numbers.