HOME plate

Palindromic Squares
rood Factorization rood Records rood
rood All Squares up to length 31 rood The Sporadic Squares rood The Subsets rood Extra Squares rood
rood triangle rood penta rood hexa rood hepta rood octa rood nona rood
rood n(n+1) rood n(n+2) rood n(n+x) rood
rood n^2+1 rood n^2+x rood n^2–x rood
rood n^2+(n+1) rood n^2+(n+x)


Palindromic numbers are numbers which read the same from
 p_right left to right (forwards) as from the right to left (backwards) p_left
Here are a few random examples : 9, 9559, 4078704, 9876543210123456789

Square numbers are defined and calculated by this extraordinary intricate and excruciatingly complex formula.
So, this line is for experts only

( base ) x ( base )orbase 2
To the right a graphical representation of the first three square numbers to whet the beginner's appetite.
sq sq sq
sq sqsq sq sq
sqsq sqsq sq sq
square 1square 4square 9


Normal and Palindromic Squares

flash So far this compilation counts 8028 square palindromic numbers.
Here is the largest Square Palindrome that Patrick De Geest
discovered, using CUDA code by Robert Xiao, on [ July 7, 2023 ].

This basenumber

has 33 digits
yielding the following palindromic square record number with even number of digits
having a staggering length of 66 digits.

This world record was achieved using CUDA code written by Robert Xiao and no longer
on Rust. Recently he generalized the program to handle arbitrary quadratics.
CUDA is a programming language, or more properly a programming toolkit,
for writing software to run on GPUs rather than CPUs. It runs about 50 times faster on our
GPUs though the logic of the code follows the Rust version closely.
I asked Robert now that his CUDA is running at warp speed how far it would reach.
He answered that as for 70 digits the time estimate on that is around ~400 days on one of
our GPUs. 60 digits is about two days of GPU time, and it’ll go up by a factor of 10 every 4 digits.
Doable but it’ll be a pretty decent power bill :) “Maybe we could get some palindrome enthusiasts
together”, as David Griffeath put it, “and get a distributed computation going.”
The program is very amenable to divide-and-conquer approaches.

bu17 All palindromic square numbers can only start or end with digits 0, 1, 4, 5, 6 or 9.
Alas, my palindromes may not have leading 0's! So the zero option must not be investigated.
1 can only be followed by an even number : 10, 12, 14, 16 or 18
4 can only be followed by an even number : 40, 42, 44, 46 or 48
5 can only be followed by 2 : 52
6 can only be followed by an odd number : 61, 63, 65, 67 or 69
9 can only be followed by an even number : 90, 92, 94, 96 or 98

bu17 There exist no palindromic squares of length  2, 4, 8, 10, 14, 18, 20, 24, 30, 38, 40, 46, 54, 56, 62, 64.
(Sloane's A034822)

Case SquareChange of variablesCUDApalin parametersBase Correction
base ver 1n.a.
A B C   1 0 0 
base = CUDAbase
base ver 2n = m + 1
A B C   1 2 1 
base = CUDAbase + 1

bu17 Mike Keith made an original study of the palindromic squares.
He was able to classify and enumerate them in a logical manner
and went even further as he tried also to create a general formula for
calculating the number of certain classes of palindromic squares,
except for the 'sporadic' solutions. Wonderful!
[Please refer to the “JRM” source detailed in section 'Sources Revealed'].

Mike had most trouble with the Asymmetric Root Family but thanks to
Dave Wilson's “lemma” he made significant progress.

What are the conditions for creating a pseudopalindrome with a palindromic square ?
Open this window wilson and read David W. Wilson's answer.

bu17 Unlike Palindromic Triangulars where it is impossible to predict a next higher one, whether its basenumber is palindromic or not,
with the Palindromic Squares (and Cubes) we have an opposite situation. Finding a next higher number is very easy.
Start e.g. with the number 11. Then repeatedly add a zero between the two 'ones' and square them.
A pattern emerges that can go on forever.

10001  100020001

There are other numbers with the same properties (e.g. 10101). The repunit numbers like '111' looks also a good candidate
for finding palindromic squares (not for cubes though) but the expansion doesn't go on forever. Nine 'ones' still produce
a palindrome when squared, but not ten 'ones'. It's a near miss as only the number 8 doesn't show up in the left part of the square.
This anomaly stays with longer repunits as well, so we must abandon this candidate.
If we take resort to higher basenumbers only then we can extend the pattern (for a while)!

1111111111  1234567900987654321 = NOT palindromic in base 10 !

Here is how Natalie Dickendasher [ November 4, 2005 ] (email) figures them out quickly in her head and impresses friends or boss :
The highest digit of the sequence will always be the quantity of 1's in the number your are squaring.
As an example lets start with my salary for next year (yah right): what is 111111 squared ?
EASY !! This number has a total of 6 digits. Therefore the highest number in the palindrome will be 6
so count to 6 and then back down. The answer is 12345654321 [35].

Finding large palindromic squares is easy if you start with some palindromic basenumbers as explained above.
So, let's concentrate on the difficult ones namely those with a non palindromic basenumber. The first six are
(26 [7]) (264 [13]) (307 [14]) (836 [15]) (2285 [19]) and (2636 [20]) and can be found without too much trouble with a spreadsheet or calculator.

Mike Bennett made an attempt in finding out what his chances are
in discovering palindromic squares and palindromic cubes.
Here is his mathematical analysis and the probability of finding
those interesting palindromic polygonal numbers.

Statistics with focus starting from Square Palindromes lengths


SP = Square Palindromes
SSP = Sporadic Square Palindromes
 Square Palindrome(SP)_length 1234567891011121314151617181920212223242526272829303132333435
A263618# SP's40307150110511901312501804813107014421050701153198
 # SSP's--0102120300150411020614041123051514
 # odd_length SSP's-- 1 2 2 3 0 5 4 1 2 6 4 4 1 3 5 5 4
 # even_length SSP's 0 0 1 0 0 1 0 1 0 0 1 0 1 2 0 1 1 
Continued...Square Palindrome(SP)_length 3637383940414243444546474849505152535455565758596061626364656667686970
A263618# SP's32090132029111811384023424961301163603830798147419810577011962----
 # SSP's3201041414012211150402131601032----
 # odd_length SSP's 2 1 4 4 4 1 2 1 5 4 2 3 6 1 3 - - 
 # even_length SSP's3 0 0 1 1 0 2 1 1 0 0 1 1 0 0 2 - -

Statistics with focus starting from Basenumber lengths


SP = Square Palindromes
SSP = Sporadic Square Palindromes
NSSP = Non Sporadic Square Palindromes
A263616 | A263617# BN's giving SP's43851161914251849317146105711541012091322921823842364973026363837994759815781201-
 # BN's giving odd_length SP's--375115191325184831704410570153982091322911813842344963016363837984749815781199-
 # BN's giving even_length (S)SP's--01001010010120113001102110011002-
 # BN's giving sporadics (↑)+(↓)--13231551274533667215543325434615-
 # BN's giving odd_length SSP's--12230541264413554214441215423613-
 # BN's giving NSSP's--2538514924164227664310265148942071312871773802334943006313797964719755771196-
A263614# BN's binaries → |B|--12244881615302652428464128931861302601763522324542995983787564709405761152-
A142150# BN's ternaries → |T|--010203040506070809010011012013014015016-
A007573# BN's asymmetrics → |A|--00000102050609010010015015016018024018026-
A000034# BN's even_root → |E|--12121212121212121212121212121212-

Can we find formulas for all or some of these sequences ?

Mike Keith gave two formulas in his article 'Classification and enumeration of palindromic squares'
published in the “Journal of Recreational Mathematics” Volume 22, Number 2 - 1990, pp. 124-132.
One for the Binary Root Family defined for all even N ⩾ 2 and another for the Binary & Ternary Root Family
combined, defined for all odd N ⩾ 3. This is a choice that Keith made as it suited more in his scheme of things.

Keith_|B| = (N3 – 6*N2 + 32*N) / 48 → for even values of N ⩾ 2 bnl = N = 30 gives result  470 

Keith_|B|+|T| = (N3 – 9*N2 + 59*N – 51) / 24→ for odd values of N ⩾ 3 bnl = N = 31 gives result  955  ( = 940 + 15)

Through David Griffeath we have now also the formula for odd values of N with the |B| separate from the |T|.
Griffeath_|B| = (N3 – 9*N2 + 47*N – 39) / 24→ for odd values of N ⩾ 3 bnl = N = 31 gives result  940 

The total number of the Even Root family is simply
|E| = 1 if N is even
|E| = 2 if N is odd

Regarding the Asymmetric family Keith writes
“Finding an exact formula for |A| remains an open problem.”

David Griffeath [ email from December 1, 2022 ] derives the right formulas for the # bnl binaries → |B|.
Start with a binary palindrome root of size 2n. It needs to have 1s on the ends.
There are n–1 remaining spots on the right half where we can choose to put 0,1,2, or 3 additional 1s.
Then symmetric spots must be chosen on the left side. So the total number of ways we can do this is
C(n-1,0)+C(n-1,1) +C(n-1,2)+C(n-1,3). After some algebra this reduces to n(n^2 - 3n + 8)/6.
Now suppose the size is 2n+1. Then any pattern of the type just described works for the digits to the right and
left of the central digit, and that can be either 0 or 1. Thus the formula for 2n+1 is simply n(n^2 - 3n + 8)/3.

Griffeath_|B| = n*(n2 – 3*n + 8) / 6 → for even values of N bnl = 30 (2n) so n=15 gives result  470 

Griffeath_|B| = n*(n2 – 3*n + 8) / 3 → for odd values of N bnl = 31 (2n+1) so n=15 gives result  940 

D. Griffeath continues his mail with
As we know, whether there are an even or odd number of digits in a square palindrome root matters substantially.
So it is natural to break up the formula this way. It is artificial to force these cases into a single formula.
But this can be done by manipulating the coefficients of the two cubics above and adding a multiplier (-1)^n to one
of the terms in order to account for parity. This is the essence of what is going on in a more complicated formula.
I can go into more details if you like, but nothing illuminating is accomplished.

And yet such a single formula for all even/odd values of N in the |B| family can be found in OEIS A263614
and was added by Colin Barker. I'll give here his Pari/gp function
(Barker_|B|) gp > a(n) = (-((-1)^n*(-78+62*n-12*n^2+n^3))+3*(-26+42*n-8*n^2+n^3))/96
After giving this command just type a(30) or a(31) to get  470  and  940  resp.
It looks intriguingly complex especially compared with the easyness of programming these Binary Root solutions
but less so when we start to dissect it...

(   ((–1)n*(n3–12*n2+62*n–78)) + 3*(n3–8*n2+42*n–26)   ) / 96

And again David comes to the rescue and helps us unraveling the Barker formula. See panel on the right ↗

  I've been feeling remiss about not showing you how that messy formula for the number of binaries doesn't
involve fancy math, but rather just a bunch of unpleasant, unenlightening algebra. So I've attached a
handwritten sketch of the computations.

The first step, in (1) and (2) is to change variables and express the formulas for the even and odd cases
in terms of the length. Just yucky algebra. Then to get the unified formula, we write the number of binaries
b_n as the sum of two cubics, one with the magic multiplier (-1)^n to flip between 1 and -1 in the even and
odd cases. The combination needs to flip between (1) and (2) as desired, so we solve for all the c's. I just
did the computation of the cubic power coefficients, but the rest are analogous. Just more yucky algebra.

Thanks David for this proper answer, much appreciated!"

Sources Revealed

Neil Sloane's “Integer Sequences” Encyclopedia can be consulted online :
Neil Sloane's Integer Sequences
The normal squares are categorised as follows :
%N The squares: a(n) = n^2. under A000290
The palindromic squares are categorised in the following manner :
%N Square is a palindrome. under A002778
%N Palindromic Squares. under A002779.

%N Numbers n such that n^2 is a palindromic square of sporadic type. under A059744
%N Palindromic squares of sporadic type. under A059745.

Click here to view some of the author's [P. De Geest] entries to the table.
Click here to view some entries to the table about palindromes.

An alternative way to get a 'structural' insight as how to imagine squares is to follow these sites :

Squares Acquaint yourself with SQUARES - by Richard Phillips
Square NumberFrom Eric Weisstein's Math Encyclopedia
Ask Dr. Math Someone gave me different numbers to find the square root of, including 14641.
My answer was 121. Something special about this is that both numbers are read
the same left to right as right to left. Do you know any other numbers in which
both the number and its square root are this way ?

A very interesting webpage by William Rex Marshall (1930-2010) is titled “Palindromic Squares”
and gives an overview of the first 67 palindromic squares known up to May 28, 2001.
The classification of these squares as set out by Michael Keith in the JRM from 1990 is also revealed. (archived)

The second highest one (3069306930693 [263]) is copied from Martin Gardner's book “The Ambidextrous Universe”
see page 40.

Another source “Curious and Interesting Numbers” by David Wells, page 185, provided me the basenumber 798644 [37].

While surfing the Internet I came across the work of Keith Devlin namely All the Math that's Fit to Print.
In chapters 17, 75 and 110 he printed some palindromic squares he got from other readers.
The highest one that originates from his publication is 6360832925898 [264].

Gustavus J. Simmons published an article about palindromic squares in the “Journal of Recreational Mathematics”,
J. Rec. Math., 3 (No. 2, 1970), 93-98, titled “Palindromic Powers”.
OEIS Source (annotated scanned copy) →

Gustavus J. Simmons published an article about palindromic squares in the “Journal of Recreational Mathematics”,
Volume 5, No. 1, 1972, pp. 11-19, titled “On Palindromic Squares of Non-Palindromic Numbers”.
OEIS Source (annotated scanned copy) →

Mike Keith (email) (website) published an article about palindromic squares in the “Journal of Recreational Mathematics”,
Volume 22, Number 2 - 1990, pp. 124-132, titled “Classification and enumeration of palindromic squares”,
and was followed by an article by Charles Ashbacher, pp. 133-135, “More on palindromic squares”.
OEIS Source (annotated scanned copy) →

I found Feng Yuan's record palindromic square of 55 digits [3992] in the following archived blog

rectangle  Click here to display rood the full listing up to length 31.
rectangle  Click here to display rood the sporadics listing of all such square palindromes (SSP).
rectangle  Click here to display rood the subsets of palindromic squares.

Asymmetric (a.k.a. Pseudopalindromic or Core) Basenumbers

Careful observation of some numbers in the list lead me to the discovery of ever greater non-palindromic basenumbers whose squares are palindromic.
Specially the numbers with indexes [48], [85], [90] and [141] attracted my attention because of the CORE number 091 in them.

[48] 1109111
[85] 110091011
[90] 111091111
[141] 11000910011
To the left there was the 'border' number 11 followed by 0, 1 and 2 zero's. To the right there was its reversal.
So without the core 091 we would have a palindromic basenumber but with 091 in the middle we always have
a non-palindromic basenumber ! The general layout becomes as follows :
11 + X_zero's + 091 + X_zero's + 11
No matter what value of X we always create a palindromic square.
The same is true if we substitute 11 with 111
111 + X_zero's + 091 + X_zero's + 111
I'm still investigating border values other then 11 or 111.
Borders like 1011 and 1101 also look promising...

A second promising CORE number exists. It is 09901 and it shows up from [131], [219], [229], ....

[131] 10109901101
[219] 1010099010101
[229] 1011099011101
[346] 100110990111001
[354] 101000990100101
[364] 101010990110101
[536] 10010109901101001
[553] 10100009901000101
[563] 10100109901100101
[570] 10101009901010101
As for now, I can't discover a regularity in it... Can you ?
It looks that this CORE number likes to be surrounded by 101 and the number zero.
Yes, it gives us a method to produce infinite palindromic squares once more :
101 + X_zero's + 09901 + X_zero's + 101

I think a new third CORE number is emerging... It is 0999001
Watch out from

[340] 100109990011001
[531] 10010099900101001
[545] 10011099900111001

Quite interesting. Let's put these three CORE numbers in a row :

Extending the pattern to the next one gives this CORE number of 9 digits :
We also observed that the length of the CORE basenumbers increases with 2 and so their respective squarelengths with 4.
As the table already shows all the CORE numbers up to length 33, we must at least add 5 digits on both sides to start with
basenumbers of lengths 19. Let's try some combinations :
1000009999000100001 yields no palindromic square but
1000109999000110001 [792] does yield a palindromic square !
Just by playing around with beautiful patterns we reveal more palindromic squares.
Wonderful !

David W. Wilson took up the thread where I left off.
Read what he posted to me about these core 'pseudopalindromes'
[ February 16, 1998 ].

If we allow a digit "n" with value "–1", then 091 is equal to the palindrome 1n1,
while 09901 = 10n01, 0999001 = 100n001, etc. Thus

10109901101 = 10110n01101 = [131]
is a sort of 'pseudopalindrome'. When we square it, lo and behold

        x 10110n01101
we obtain a palindrome because the sums of the individual rows happen to lie between 0 and 9 inclusive.
Here's a palindromic square family :
111n1112 = 11091112 = 1230127210321 = [90]
101010n0101012 = 10100990101012 = 1020300010207020100030201 = [219]
100100100n0010010012 = 10010009990010010012 = 1002003000001002007002001000003002001 = [812]
I think you get the picture. The family is infinite, as is the family
1111n11112 = [90]
10101010n010101012 = [570]
In fact, any pseudopalindrome with a palindromic square can be interspersed with equal numbers of zeroes
to generate another pseudopalindrome with a palindromic square.

More Patterns

And what about this repeat pattern of the item 3069
and that is finalized alternatively with a chopped off and rounded version of it namely a 3 or 307...

[4] 3
[14] 307
[31] 3069 3
[56] 3069 307
[95] 3069 3069 3
[161] 3069 3069 307
[263] 3069 3069 3069 3
Each time the length increases with 2
and the length of the resulting squares increases with 4.
So, logically the next one should be 306930693069307 but alas... the square is NOT palindromic !
Oh well, it can not work every time ! On [ January 5, 1997 ] this near miss popped up on my
computerscreen : 306950094269977057. The system surely knows how to comfort me...

3069 occurs as displacements to powers of ten so that this number forms the nearest (probable) prime to those axes :

1010013069 is the largest prime of 1001 digits

  101555 + 3069
102399 + 3069
105016 + 3069
105063 + 3069
109896 + 3069

NEVER ODD OR EVEN p_left Read title backwards please !

It looks as though the decent sufficiently-random nonpatternlike unpredictable nonpalindromic basenumbers become very rare.
In the table (see Full Listing or the Subsets) I highlighted them using a lightblue background in the side-cells.
And even then a further distinction can be made. Consider the even and odd length values for a minute.
Sporadic Palindromic Squares with an even length are just a plain minority. Until now I can only list twenty of them.
These are highlighted in the table by means of a aquamarine background color in the side-cells.

Score 'subset E' = 20   

I 'almost' solved a very ancient problem namely : squaring the circle (pi = 3,1415....)

[415]    314155324482867

This basenumber starts with the the number 2201 which is (to me) the only known nonpalindromic basenumber
of a palindromic cube ! The cube of 2201 equalling 10662526601.

[481]    2201019508986478

Here's another attractive but finite expansion starts with the number 1 whereby 01 is repeatedly added.
The following series arises :
10101010101010101102030405060708090807060504030201 (° see conjecture below)
1010101010101010101  10203040506070809100908070605004030201 = QUITE UNpalindromic !

10101010101010101 is indeed the smallest integer that generates
a palindromic square 102030405060708090807060504030201
that is also pandigital (contains all the ten digits).

Here is a good place to talk about a famous conjecture that nobody
could prove or disprove for more than 80 years.
I must thank Mike Keith for letting me know this fact through an email message.
Mike has heard that this conjecture originates from
L. E. Dickson's famous “History of the Theory of Numbers”.
Can someone with access to this source confirm this ?

History :
My table lists exhaustively all palindromic squares up to lengths 31.
I also listed all the palindromic squares of length 32.
Palindromic squares of  'even' nature seem to be very popular among the record
breaking submitters. They told me there are no gaps for the 'even' length 32 !
So, in fact I had to finish checking only length 33...
Of which I checked all squares beginning with 1, 5 and 9 !
( and 50 % of those beginning with digits 4 and 6 ).
I collected a total of 151 palindromic squares beginning with digit 1.
(Un)lucky for me Dickson's number 102030405060708090807060504030201
( 101010101010101012 ) [572] is the 86th one. Anyway after checking these 86 squares
I could proudly announce that the conjecture was finally proven [ May 3, 1998 ].
The second smallest number [633] that answers to these rules is this one (also of length 33) :
118431915157648212 = 140261185279083838380972581162041.

bu17 Sloane's A001110 gives the first numbers that are both Square and Triangular.
1, 36, 1225, 41616, 1413721, 48024900, ...
Consult also Eric Weisstein's page Square Triangular Number

bu17 Sloane's A036353 gives the first numbers that are both Square and Pentagonal.
1, 9801, 94109401, 903638458801, 8676736387298001, ...
Consult also Eric Weisstein's page Square Pentagonal Number.

bu17 Sloane's A036354 gives the first numbers that are both Square and Heptagonal.
1, 81, 5929, 2307361, 168662169, 12328771225, 4797839017609, ...
Consult also Eric Weisstein's page Square Heptagonal Number.

bu17 Sloane's A036428 gives the first numbers that are both Square and Octagonal.
1, 225, 43681, 8473921, 1643897025, ...
Consult also Eric Weisstein's page Square Octagonal Number.

bu17 Sloane's A036411 gives the first numbers that are both Square and Nonagonal.
1, 9, 1089, 8281, 978121, 7436529, ...
Consult also Eric Weisstein's page Square Nonagonal Number.

Alain Bex (email) gave also some palindromic squares in base 12.
Link to Palindromic Numbers other than Base 10


( © All rights reserved ) - Last modified : September 7, 2023.

Patrick De Geest - Belgium flag - Short Bio - Some Pictures
E-mail address :