| World!Of Numbers | ![]() |
||
Palindromic Numbersbeyond base 10 Page 1 | |||
Palindromes in bases 2 and 10.
The main source for this table comes from the following weblink.
Binary/Decimal Palindromes by Charlton Harrison (email) from Austin, Texas.
See also Sloane's sequences A007632 and A046472.
" I just finished writing a distributed client/server program for finding these numbers, and I currently
have it running on 4 different machines at the same time and I'm finding them A LOT faster. That's how
I was able to come up with those new ones. I'd say there are more to come in the near future, too."
| [ December 1, 2001 ] Charlton Harrison once found this record binary 110 0010111100 0010101010 1101000011 1010000010 0000101110 0001011010 1010100001 1110100011 7475703079870789703075747 The binary string contains 83 digits ! |
[ April 11, 2003 ]
Dw (email) wrote me the following :
"Using a backtracking solver, I have found larger numbers.
The first of these, which is the next after the one mentioned above, is
50824513851188115831542805 (86 bit, 3*5*11*11*17*17*83*11974799*97488286319).
There are no other 86 bit double palindromes.
I also have found two 89 bit double palindromes, but I am not sure if they
These numbers are
are the next ones. There may be some lower ones in 89 bit (haven't searched
that space completely yet) or in 87 bit that I haven't found.
532079161251434152161970235 (5*29*85839676103*42748430836381)
and
552963956270141072659369255 (5*7*7*71*441607*71984077228507867)
As can be seen by their factor representation, they are all composite."
50824513851188115831542805 {26}
10101000001010100000100110101010101001100000000110010101010101100100000101010000010101 {86}
532079161251434152161970235 {27}
11011100000100000001001010010000011001110101010101110011000001001010010000000100000111011 {89}
552963956270141072659369255 {27}
11100100101100110101011000010001001111100100100100111110010001000011010101100110100100111 {89}
"They are, in opposite sorted order:When asking Dw for an explanation or description in a few words
138758321383797383123857831 (87 bit, composite, the only 87 bit double palindrome)
390714505091666190505417093 (89 bit, prime)
351095331428353824133590153 (89 bit, composite)
795280629691202196926082597 (90 bit, composite, not sure if this is the next one)."
"A backtracking solver is one that solves a problem made up of smaller
problems by trying every one except if it knows its earlier guesses make all
later ones depending on them impossible.For instance, if you're in a maze and know that all corridors with green
walls eventually lead to a dead end, you can turn around as soon as you find
such a wall (backtrack) if you're trying to find the exit.The smaller problem is avoiding a dead end, and the larger one is
finding the exit.If you want the details:
My general strategy goes that to find a double palindromic number, the
solution to its palindromic decimal representation minus its binary
representation must be zero (since they are equal).Furthermore, you can write a decimal palindrome like 101 * a + 10 * b, where
a and b are digits. The same can be done for binary, and you end up with a
giant (linear diophantine) equation of positive decimal and negative binary factors.The factors can then be solved, one at a time, using the extended euclidean
I also have a table of maximum and minimum values for each step. That way, if
algorithm. These are the smaller problems.
it's impossible for the binary factors left to subtract enough from the
decimal factors to get zero (or the other way around), the solver backtracks."
| [ April 13, 2003 ] Dw once found this record binary 1010010001 1101011100 1110010101 0010100001 0100000010 1000010100 1010100111 0011101011 1000100101 795280629691202196926082597 The binary string contains 90 digits ! The decimal string contains 27 digits ! |
138758321383797383123857831 {27}
111001011000111001101111010110010111011100111001110111010011010111101100111000110100111 {87}
351095331428353824133590153 {27}
10010001001101011010101000000110111100000100000100000111101100000010101011010110010001001 {89}
390714505091666190505417093 {27}
10100001100110001000000111100001100011000111011100011000110000111100000010001100110000101 {89}
795280629691202196926082597 {27}
101001000111010111001110010101001010000101000000101000010100101010011100111010111000100101 {90}
"I have been trying to find a polynomial time (growth of time needed is a
polynomial of number of bits) algorithm for finding double palindromes of
base 2 and 10. I haven't succeeded yet (my backtracking solver being
exponential), but I have found some interesting things.For one, to find double palindromes in base 2 and 8 is very simple. Each base 8
digit maps to three bits. Therefore, every double palindrome must consist
of digits who themselves are double palindromes.For instance, 757 as well as 575 is double palindromic. (These values are 495
and 381 in decimal respectively).
5 maps to 101 in binary, and 7 to 111 in binary.I have found 1609061098335005338901609061 (91 bits composite),
Another approach could be to create a networked version (to do the search on
and this is the only 91 bit one. No 92 bit double palindrome exists, and
93 bits seems to require several days of searching; therefore I'm trying to
find a polynomial time algorithm as mentioned above.
multiple computers), but I haven't done that yet."
| [ May 21, 2003 ] Dw once found this record binary 1 0100110010 1111101111 1100001110 1100100000 0010001000 0000100110 1110000111 1110111110 1001100101 1609061098335005338901609061 The binary palindrome contains 91 digits ! The decimal string contains 28 digits ! |
1609061098335005338901609061 {28}
1010011001011111011111100001110110010000000100010000000100110111000011111101111101001100101 {91}
[ June 12, 2003 ]
Dw (email) found new Binary/Decimal Palindromes :
"I rewrote my program to use another strategy at finding the numbers, and this
let me search somewhat faster. As a result, I have found binary/decimal
palindromes up to 102 bits -- broke the 100 bit barrier so to speak.These are:
None at 92 or 93 bits.
There may be higher ones at 102 bits; I haven't completed the search there."
17869806142184248124160896871 (94 bits)
19756291244127372144219265791 (94 bits)
30000258151173237115185200003 (95 bits)
30658464822225352222846485603 (95 bits)
56532345659072227095654323565 (96 bits)
None at 97 or 98 bits.
378059787464677776464787950873 (99 bits)
1115792035060833380605302975111 (100 bits)
None at 101 bits.
3390741646331381831336461470933 (102 bits)
17869806142184248124160896871 {29}
1110011011110110001110101001000001000000000011001100000000001000001001010111000110111101100111 {94}
19756291244127372144219265791 {29}
1111111101011000000101011001100101101101100001111000011011011010011001101010000001101011111111 {94}
30000258151173237115185200003 {29}
11000001110111110100001110001010010000110100011011000101100001001010001110000101111101110000011 {95}
30658464822225352222846485603 {29}
11000110001000000010110011101000100010000101111111110100001000100010111001101000000010001100011 {95}
56532345659072227095654323565 {29}
101101101010101001110101110101101111011010100000000001010110111101101011101011100101010101101101 {96}
378059787464677776464787950873 {30}
100110001011001001110111010000000001110111000111010111000111011100000000010111011100100110100011001 {99}
1115792035060833380605302975111 {31}
1110000101010101000110001001111111101011111110110110110111111101011111111001000110001010101010000111 {100}
3390741646331381831336461470933 {31}
101010110011000001001111000000100001000111101001011110100101111000100001000000111100100000110011010101 {102}
[ June 17, 2003 ]
Dw (email) adds :
" There are no numbers for 103 bits."[ Note : In fact there is one! See index number 97. PDG ]
| [ June 17, 2003 ] Dw once found this record binary 10 1010110011 0000010011 1100000010 0001000111 1010010111 1010010111 1000100001 0000001111 0010000011 0011010101 3390741646331381831336461470933 The binary palindrome contains 102 digits ! The decimal string contains 31 digits ! |
Binary/Decimal Palindromes by Charlton Harrison (email) : the longest list in existence ?
[ September 30, 2015 ]
Three more stunning numbers could be retrieved from Sloane's OEIS database.
See index numbers 124, 125 & 126.
| [ September 30, 2015 ] A former record binary 100110011011011101000001000010000011000111001011100111100011101000 00101110001111001110100111000110000010000100000101110110110011001 1634587141488515712882175158841417854361 The binary palindrome contains 131 digits ! The decimal string contains 40 digits ! |
[ March 8, 2020 ]
Many more numbers could be retrieved from Sloane's OEIS database.
See index numbers up to 147. The record dates from the end of 2015.
| [ December 30, 2015 ] The current record binary Search team : Robert G. Wilson v, Charlton Harrison, Ilya Nikulshin & Andrey Astrelin 11010001010011101000000001001100010000000010110001011110100100101011100110101 0101100111010100100101111010001101000000001000110010000000010111001010001011 9335388324586156026843333486206516854238835339 The binary palindrome contains 153 digits ! The decimal string contains 46 digits ! |
Binary/Decimal Palindromes by Charlton Harrison (email) : the longest list in existence ?
|
I sampled the following base X palindromic numbers sequences from the table : Click here to view some entries to the table about palindromes. |
|
|
Kevin Brown informed me that he has more info about tetrahedral palindromes in other base representations.
Link to his article :
On General Palindromic Numbers ![]()
Alain Bex (email) sent me the first palindromic squares in base 12 - go to topic.
Dw (email) found several binary/decimal palindromes of record lengths - go to topic.
Richard Gosiorovsky (email)
Also Palindromic in Base 16 (OEIS A029731)
[ do 7-8/3/2024 7:33 ]
Dear Mr. De Geest,
I would like to ask you for updating the table re. numbers that are palindromic in bases 10 and 16.
I did some progress on it, and found 51 new members of the sequence. See indices 84 up to 134.
Full list of new members is in the text file in the attachment.
Thank you,
Richard Gosiorovsky, Bratislava
Richard
//
// Looking for Numbers that are palindromic in bases 10 and 16 simultaneously
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define ull unsigned long long // 64-bit integer
extern ull mul128(ull *c, ull a, ull b); // mul128.asm, see here:
// mul128 PROC
// mov rax, rdx ; rdx - 2nd argument, r8 - 3rd argument
// mul r8 ; multiply rax * r8 -> result = 128-bit rdx:rax
// mov qword ptr [rcx], rdx ; rcx - 1st argument
// ret ; return rax
// mul128 ENDP
inline ull reverse(ull x) { ull q, y=0; while(x) { q=x/10; y=10*(y-q)+x; x=q; } return y; }
inline int is_palind_128(ull h64, ull l64, int sh1, int sh2)
{
while(sh1 >= 0 ) { if ((h64>>sh1 & 0xf) != (l64>>sh2 & 0xf)) return 0; sh1-=4; sh2+=4; } sh1 = 60;
while(sh1 > sh2) { if ((l64>>sh1 & 0xf) != (l64>>sh2 & 0xf)) return 0; sh1-=4; sh2+=4; } // here we test only in lower 64-bit
return 1;
}
// 012345678901234567890
#define FROM 10000000000000LL
#define UPTO 100000000000000LL
#define M4 10000000000LL
#define M8 1000000
#define M12 100
int main(int argc, char *argv[])
{
int sh=-999, k=0;
ull h64, l64; // upper & lower 64-bit of palindrome
for(ull i=FROM; i<UPTO; i++) // i - half of palindrome
{
if (i%1000000000==0) printf(" %lld mld. %d sec. %16llx\r", i/1000000000, clock()/1000, h64);
l64 = mul128(&h64, i/10, UPTO) + reverse(i); // create palindrome: i - for even symmetry, i/10 - for odd symmetry
if (sh==-999) { sh=60; while((h64>>sh & 0xf)==0) sh-=4; } // find initial shift for leading hex digit
if (h64>>(sh+4) & 0xf) sh+=4; // hex digit overflow happened -> increase shift
if (i % M4 == 0) if ((h64 >>(sh ) & 0x000f) != (l64 & 0x000f)) { i+=M4 -1; continue; } // skip this foursome of decimal digits
if (i % M8 == 0) if ((h64 >>(sh- 8) & 0x00f0) != (l64 & 0x00f0)) { i+=M8 -1; continue; }
if (i % M12== 0) if ((h64 >>(sh-16) & 0x0f00) != (l64 & 0x0f00)) { i+=M12-1; continue; }
// 3*4 - first/last 3 hex digits was already tested by 3 upper conditions
if (is_palind_128(h64, l64, sh-3*4, 3*4)) printf(" %4d. %lld %8llx:%016llx %d sec.\n", ++k, i, h64, l64, clock()/1000);
}
printf(" total time = %d sec.\t\t\t\n", clock()/1000); getchar();
}
Eshed Schacham's article can be found following this link:
https://ashdnazg.github.io/articles/22/Finding-Really-Big-Palindromes
As a software developer he also made public his .c code he wrote for this topic and explains the algorithm in great depth.
To my surprise he found 35 new decimal palindromes that are also palindromic in base 2 or binary.
I added them forthwith to my webpage. Please refer to indices 148 up to 183 in the very first
scrolltable of this very page. Impressive if you consider their record lengths.
Richard Gosiorovsky (email)
Dual-base Palindromes
[ do 2/5/2024 6:02 ]
Hi Patrick,
I am sending you in the attachment several
new records for dual-base palindromes:
base 10 & 3: 4 new records → From [71] to [74] base 10 & 4: 35 new records → From [65] to [99] base 10 & 5: 100 new records → From [84] to [183] base 10 & 6: 9 new records → From [110] to [118] base 10 & 7: 8 new records → From [74] to [81] base 10 & 8: 43 new records → From [89] to [131] base 10 & 9: 5 new records → From [71] to [75] base 10 & 16: 9 new records → From [135] to [143]
Thank you for this interesting entertainment.
Richard
Richard Gosiorovsky (email)
Dual-base Palindromes (bases 10 & 5)
[ do 5/8/2024 16:44 ]
Hi Patrick, Hi Eshed,
I am here again, I would like to ask you for updating dual-base
palindrome sequence A029962 (bases 10 & 5), where I found 52 new
members (in the attachement). I improved algorithm a bit, but it
is still far from optimal. Changing bases to 10 & 2 I can not
achieve Eshed's records at all. Basic idea remains the same.
Richard
PS: For better understanding I am sending the source code too
(it uses GMP - GNU multiple precision library)
/*
Looking for numbers simultaneously palindromic in bases 10 and 5
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "gmp.h"
#define ODD 1 // 0 - even symmetry 1 - odd symmetry
#define N 24
#define M (2*N-1) // length of palindrome
mpz_t tmp, aux;
mpz_t D[128], P[128]; // pre-computed constants: D[i] = 10^i, P[i] = 5^i
mpz_t e[128], h[128]; // e[] - end of palindrome, h[] - beginning of palindrome
int d[128], m1, m2; // 5^m = divisor for leading digit
char s[256], s1[256], s2[256];
int ispalind(char *s, int n) { for(int i=0; i<n/2; i++) if (s[i] != s[n-i-1]) return 0; return 1; }
void init_m1(mpz_t x) { m1 = M; do { m1++; mpz_fdiv_q(aux, x, P[m1]); } while (mpz_cmp_ui(aux, 5) >= 0); }
void init_m2(mpz_t x) { m2 = M; do { m2++; mpz_fdiv_q(aux, x, P[m2]); } while (mpz_cmp_ui(aux, 5) >= 0); }
int get_digit1(mpz_t x, int i) // get i-th leading digit of x in base 5
{
mpz_fdiv_q(aux, x, P[m1]);
if (mpz_cmp_ui(aux, 5) >=0) m1++;
if (mpz_cmp_ui(aux, 0) <=0) m1--;
mpz_fdiv_q(aux, x, P[m1-i]);
return mpz_fdiv_ui(aux, 5);
}
int get_digit2(mpz_t x, int i) // get i-th leading digit of x in base 5
{
mpz_fdiv_q(aux, x, P[m2]);
if (mpz_cmp_ui(aux, 5) >=0) m2++;
if (mpz_cmp_ui(aux, 0) <=0) m2--;
mpz_fdiv_q(aux, x, P[m2-i]);
return mpz_fdiv_ui(aux, 5);
}
void recur(int w)
{
if (w==6) { for(int i=0; i<6; i++) printf("%d", d[i]); printf(" %d\"\r", clock()/1000); }
if (w==N)
{
mpz_add(tmp, h[N-1], (ODD==0)?e[N-1]:e[N-2]);
mpz_get_str(s, 5, tmp);
if (ispalind(s, strlen(s)))
{
for(int i=0; i<N; i++) printf("%d", d[i]);
printf(" %d %d sec.\n", ODD, clock()/1000);
}
return;
}
for(d[w]=0; d[w]<=9; d[w]++)
{
mpz_mul_ui(tmp, D[w], d[w]); mpz_add(e[w], e[w-1], tmp);
mpz_mul_ui(tmp, D[M-w-ODD], d[w]); mpz_add(h[w], h[w-1], tmp);
mpz_fdiv_q(tmp, e[w], P[w]);
int f = mpz_fdiv_ui(tmp, 5);
mpz_add(tmp, h[w], D[M-w-ODD]);
if (f==get_digit1(h[w], w) || f==get_digit2(tmp, w)) recur(w+1);
}
}
int main()
{
printf("\n N = %d ODD = %d\n\n", N, ODD);
mpz_init(tmp); mpz_init(aux);
for(int i=1; i<128; i++) { mpz_init(D[i]); mpz_init(P[i]); mpz_init(e[i]); mpz_init(h[i]); }
mpz_set_ui(D[0], 1); for(int i=1; i<128; i++) mpz_mul_ui(D[i], D[i-1], 10);
mpz_set_ui(P[0], 1); for(int i=1; i<128; i++) mpz_mul_ui(P[i], P[i-1], 5);
for(d[0]=1; d[0]<=9; d[0]++)
{
mpz_set_ui(e[0], d[0]);
mpz_mul_ui(h[0], D[M-ODD], d[0]);
int f = mpz_fdiv_ui(e[0], 5);
mpz_add(tmp, h[0], D[M-ODD]);
init_m1(h[0]);
init_m2(tmp);
if (f==get_digit1(h[0], 0) || f==get_digit2(tmp, 0)) recur(1);
}
printf(" total time = %d sec.\t\t\t\n", clock()/1000);
getchar();
}
Richard Gosiorovsky (email)
Dual-base Palindromes (bases 10 & 5)
[ do 30/10/2025 19:01 ]
Hi Patrick,
I am sending you in the attachement 42 new members of OEIS sequence
A029962 (numbers simultaneously palindromic in bases 10 and 5).
base 10 & 5: 42 new records → From [236] to [277]
I used the same algorithm as the last time plus some optimization
and longer running time (two weeks).
Richard
[
TOP OF PAGE]