Hobby3 min read

Problem of the Year: A Number Written Twice

A number theory problem I invented before falling asleep: find the smallest N that becomes a perfect square when written twice in a row.

Abstract editorial illustration of two identical embossed strips of small tiles meeting at a seam beside a pale square plate with a faint grid, one blue point glowing at its corner

Most of my math problems are born in the same place: in bed, with the lights off, in the few minutes before I fall asleep. I have been doing this for more than ten years. Something catches my attention during the day, a digit pattern or a number that looks too tidy, and at night it turns into a question. Most of those questions do not survive until morning. The few that do are the ones I write down.

The habit started when I was a kid and became serious during the Math Olympiad years, when solving problems stopped being enough and I started making them. Some ended up on OliForum, on Campigotto, on Brilliant, and in the collection on this site. Many more are scattered across notebooks and LaTeX files I have never sorted. Collecting them properly is on my list.

This year one of them felt good enough to deserve a title, so here it is: my problem of the year.

The problem

Take a positive integer N and write it twice in a row. Call the result N|N. For example, if N = 37, then N|N = 3737.

Find the smallest N such that N|N is a perfect square.

It looks like something you could settle by trying small numbers. You cannot. The answer exists, but it is much larger than intuition suggests, and the interesting part is understanding why it cannot be any smaller.

The variant

Now write N followed by 2N, and call the result N|2N. This time a tiny solution exists: for N = 3 you get 36, which is 6². So the question becomes:

Find the second smallest N such that N|2N is a perfect square.

The first solution has one digit. The second one has twenty-two. That jump is my favourite thing about the whole problem.

Try it

Pencil and paper are enough for the key idea, although a computer is handy for checking the final number. When you want to compare, the full solution to both parts is on the problem page. If you find a cleaner argument than mine, write to me.

If you want another one while you are at it, try Guess the digits, still one of my favourite problems I have ever invented. Two players each know only the product or only the sum of two digits drawn from a box, and four short sentences of "I don't know" and "now I do" are enough to pin the digits down.

mathnumber-theoryproblem-solvingolympiad