# Find any two consecutive $100$-digit numbers whose sum of digits is a perfect square

Find any two consecutive $$100$$-digit numbers whose sum of digits is a perfect square.

this is all I did and I am stuck

lets say $$abc \dots m$$ is a $$100$$ digit number whose sum of its digits is a perfect square

$$a+b+c+.....+m = k^2$$

lets say $$abc \dots m+1$$ is a $$100$$ digit number whose sum of its digits is a perfect square

$$a+b+c+.....+m+1 = q^2$$

$$k^2 = q^2 - 1$$

and I am just stuck

• What are the possible limits on the squares that could be the results of this effort? Would it make sense to start with all zeros except the leading and last digits? Commented Oct 31, 2023 at 18:24
• When you add $1$ to a number, usually its digit sum will increase by $1$ ... could that possibly result in consecutive digit sums equaling squares? How else could the digit sum change when $1$ is added to the original number? Commented Oct 31, 2023 at 18:32
• Hint #1: In base-ten, all perfect squares end in 0, 1, 4, 5, 6, or 9. Hint #2: All integers are congruent modulo 9 to the sum of their digits. Work it out from there.
– Dan
Commented Oct 31, 2023 at 18:33
• @Dan i'm a 9th grade student i dont know what congruent modulo is could you please explain in details Commented Oct 31, 2023 at 18:41
• @GregMartin has the correct hint... you're stuck because if adding $1$ doesn't lead to carrying over into the tens place, the digit sum will just increase by $1$, and there aren't two (positive) perfect squares that differ by $1$. What if the last few digits go from $09$ to $10$, though? Or from $099$ to $100$? Commented Oct 31, 2023 at 19:00

Let the lower number end in $$n$$ $$9$$s. Then, the digit sum of that number is $$9n-1$$ more than the digit sum of the number above, so $$9n-1$$ is a difference of two squares.

If $$n=2$$ then $$9\times2-1=17=9^2-8^2$$.

A potential lower number could be: $$\underbrace{11\ldots11}_{63\,1\mathrm{s}}\underbrace{00\ldots00}_{35\,0\mathrm{s}}99$$ so the higher number is $$\underbrace{11\ldots11}_{63\,1\mathrm{s}}\underbrace{00\ldots00}_{34\,0\mathrm{s}}100$$

Let $$Q(n)$$ (from German Quersumme) denote the sum of the (base-ten) digits in the integer $$n$$.

It is a well-known fact that $$Q(n)$$ is congruent modulo 9 to $$n$$.

Also, if you look down the diagonal of the base-9 multiplication table, you'll see that all the perfect squares end in 0, 1, 4, 7. Put another way, if $$n$$ is a perfect square, then:

$$Q(n) \equiv n \in \{0, 1, 4, 7\} \pmod{9}$$

For both $$Q(n)$$ and $$Q(n+1)$$ to be perfect squares, the only possible combination is $$Q(n) \equiv 0 \pmod{9}$$, so that $$Q(n+1) \equiv 1 \pmod{9}$$.

Now, let's choose two perfect squares, one of which is a multiple of 9, and one that's one more than a multiple of 9. I'll pick $$Q(n) = 81$$ and $$Q(n + 1) = 64$$.

Note that in order for $$Q$$ to decrease when $$n$$ is incremented, we need a rollover from 9 to 0 in the unit's place. So, we have:

• $$n$$ = (99 digits adding to 72)$$9$$
• $$n + 1$$ = (99 digits adding to 64)$$0$$

Since $$72 > 63$$, we'll need another place-value column affected by rollover.

• $$n$$ = (98 digits adding to 63)$$99$$
• $$n + 1$$ = (98 digits adding to 64)$$00$$

OK, so now we just need two consecutive digits in the hundred's place. I'll pick $$8$$ and $$9$$.

• $$n$$ = (97 digits adding to 55)$$899$$
• $$n + 1$$ = (97 digits adding to 55)$$900$$

And the “97 digits adding to 55” must be the same string of digits for the two numbers. I'll choose to construct it as 1 + 90 0's + 6 9's. giving the pair of numbers:

• 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000999999899
• 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000999999900

So there you go: Two consecutive 100-digit integers whose digit sums (81 and 64) are both perfect squares.

Use $$n=4040404...$$

The sum of the digits would $$4\times 50 = 200$$

Since $$15$$ squared is $$225$$, you'll need to add $$25$$

Divide $$n$$ by two $$=2020202...$$ and make two copies, then change $$12$$ of the $$0$$s to $$1$$s (same digits for each copy) and add an extra $$1$$ to one of the numbers.