
But that is all in the past. After finding the Parker Square, he decided to completely ignore property $$$3$$$ from now on and to instead give property $$$2$$$ a new twist. He now considers multiplicative magic squares, which are exactly like normal magic squares except that the products along all rows, columns, and diagonals have to be equal, instead of the sums. Who knows, Matt might even manage to find a proper multiplicative magic square in the future!
With this definition at hand, Matt wrote some terrible Python code – his words, not ours – to count the number of multiplicative magic $$$3\times 3$$$ squares where the product of the numbers in a single row, column, or diagonal is at most $$$n$$$. As you may have guessed by now, his code is way too slow. Therefore, we task you to do the same, just more efficiently. Given an integer $$$n$$$, count the number of multiplicative magic $$$3\times 3$$$ squares with product at most $$$n$$$.
$$$^{\text{∗}}$$$Recreational mathematician, author, comedian, YouTube personality, and science communicator.
The input consists of:
For each test case, output the number of multiplicative magic squares with product at most $$$n$$$.
3 500 1000 3000
8 16 56
| Название |
|---|


