# Professor Halfbrain and the next square

Yesterday afternoon I met professor Halfbrain at a coffee place. The professor looked very tired. He told me that he hadn't slept for many days, spending his time with writing lots of zeros and with computing square roots.

"Writing lots of zeros?", I asked him surpised. It turned out that the professor had first written down the integer $49$ and then inserted one $0$ in the middle.

"Computing square roots?", I asked him. It turned out that the professor had noticed that his first number $409$ wasn't a perfect square (whereas the number $49=7^2$ is a well-known square). So he had inserted another $0$, and noticed that $4009$ wasn't a perfect square either. He inserted one more $0$, but $40009$ is not square. And so on. After inserting many many further zeros into the number, professor Halfbrain finally managed to detect a square number.

Let us denote by $H(k)$ the integer whose decimal representation is of the form $4000\cdots009$ with exactly $k$ zeros between the digits $4$ and the $9$.

Question: What is the smallest integer $k\ge1$, for which $H(k)$ is a perfect square? Does such a $k$ really exist, or has the professor once again made one of his notorious mathematical blunders?

$X^2 = 4000..009$
$X$ is obviously odd. Let's say $X = 2y+3$:
$4y^2+12y+9 = 4000..009$
$y^2+3y = 1000..000 = 10^{k+1}$
$y * (y+3) = 2^{k+1} * 5^{k+1}$

$y$ and $y+3$ are different modulo 2 and modulo 5, also $y<y+3$, thereby $y = 2^{k+1}$ and $y+3 = 5^{k+1}$. But this works only for $k = 0$.

• Much cleaner then mine, but basically saying the same, +1 – DrunkWolf Oct 22 '15 at 14:14
• How do you get from the last equation to the conclusion that y must be 2^(k+1)? The conditions are also fulfilled if you can find a solution for y=(2^n)*(5^m) and y+3=(2^m)*(5^n), where n+m=k+1. – jarnbjo Oct 22 '15 at 14:52
• @jarnbjo, you missed "parity of y and y+3 is different". That's why either n = 0 or m = 0 in your equations. and since y < y + 3 and 2 < 5 it is m = 0 and n = k+1. – klm123 Oct 22 '15 at 15:07
• @klm123 I didn't miss it, I just didn't understand the significance before you explained it. What you are essentially saying (or at least implying without actually saying it) is that either y or y+3 must be odd and hence cannot contain 2 as a prime factor. – jarnbjo Oct 22 '15 at 16:25

It's not possible, there is no such $k$. We know, because the number ends on 9, that the last digit of our would be perfect square is either a 3 or a 7. We therefor know that if there was a perfect square, it would be of the form $a*10+3$ or $a*10+7$, where a is integer. Squaring this number would have to give $H(k)$.

However, when we do this, we get $100*a^2+60*a+9$ and $100*a^2+140*a+49$ respectively.

This reasoning isn't as helpful as i thought it was, so we can do without, but i'll leave it in case anyone wants to talk about it :P

But since $10^n$ with $n$ an integer can't be cleanly divided by either 6 or 14 for any value of $n$, we are always left with 'stray numbers' where $H(k)$ demands that we have zeros

We are left with the equations:

1) $4*10^{k+1}=100*a^2+60*a$ or

2) $4*10^{k+1}=100*a^2+140*a+40$

Taking (1) we simplify to $5(5*a^2+3*a)=10^{k+1}$, which has a single integer solution (according to wolfram alpha) at $k=0$ and $a=-1$, (which gives the value -7 for our perfect square) but a requirement is that $k>0$

Taking (2) likewise gives just 1 integer solution, namely $k=0$ and $a=0$, but $k>0$

• Could you expand on that last sentence? I can't see how the $10^n$ not being divisible by either 6 or 14 relates to the sentence before that – Ivo Beckers Oct 22 '15 at 12:52
• @IvoBeckers I actually agree with you that it's a bit unclear, and it's perhaps more of an 'insight' thing, but i'll update with proper math :P – DrunkWolf Oct 22 '15 at 13:08
• @IvoBeckers It's hard to give a mathematical proof of the step i gave, and the more i think about it, it might not be accurate, as in, unrelated. Seeing as the same question with 25 instead of 49 also has no k., altough obviously the same question with 100 does give multiple vlaues for k. Somehow it helped me though when i visualized the problem. – DrunkWolf Oct 22 '15 at 13:39