[seqfan] Re: Squares with even-positioned digits matching the original number

Tim Peters tim.peters at gmail.com
Sat Dec 2 05:46:47 CET 2023

FYI, I found only 7 solutions with no more than 18 decimal digits, but all
save one are trivial variants of the one you already found:

899552419664035532  NEW ONE

I'm not certain there aren't others < 10^18 - the code was mildly clever to
avoid needing to check every number, and "clever" can hide errors.

Short course: can any solution end with, say, 27? No: modulo 100, if n ends
with 27, n^2 ends with 29. So n can't be a solution: throw away the
trailing 9 in 29, showing that n must end with 2. But n ends with 7.

In this way, longer and longer feasible suffixes are constructed, tacking
on a digit "on the left", one at a time.

This saves an enormous amount of futile checking, but by the time all
18-digit feasible suffixes were constructed, there were over 500 million in
play. At that point I was running out of RAM.

The original example you found was discovered in well under 10 seconds.

On Fri, Dec 1, 2023 at 1:54 PM David Radcliffe <dradcliffe at gmail.com> wrote:

> Hi all,
> I recently came across sequence A326418, which is described as "Nonnegative
> numbers k such that, in decimal representation, the subsequence of digits
> of k^2 occupying an odd position is equal to the digits of k." I was
> wondering about the analogous problem for even positions, but that sequence
> is not in the OEIS.
> I performed a search up to 10^16, and the only example I found was k =
> 9678692507732, excluding multiples of 10.
> This is a term because k^2 = 93677088659227550879783824, and if we remove
> every other digit from k^2, starting with the units digit, we get back to
> 9678692507732.
> Are there other solutions? I am intrigued by this sequence because the
> first term is so large, but I don't know enough terms to propose it for
> inclusion in the OEIS.
> - David
> --
> Seqfan Mailing list - http://list.seqfan.eu/

More information about the SeqFan mailing list