2

$p^2$ $\text{(or 2-palindrome) definition: }$

I call a palindrome $n$-palindromic or $p^n$ if it is palindromic in $n$ consecutive number bases.

For example, $10$ is $p^2$ since it is palindromic in two consecutive bases $10=101_3=22_4$

A number is palindromic in base $b$ if its representation in that base is read the same from both ends. Example: $121$ is palindromic in base $10$. The $9$ is palindromic in binary since $9=1001_2$ .



In this question, I'm concerned with $p^2$s which have $9$ digits in their palindromic bases.

Q: More precisely, given number base $b$, how do you find all $p^2$'s palindromic in $b$ and $b+1$, which also have $9$ digits in the given number base?

If we observe all $9$ digit palindromes in some base $b$, then a small amount of them will also be palindromic in base $b+1$ as well. The number of $p^1$s between two consecutive $p^2$s is the gap between those two $p^2$s. If we could predict the gaps, we could directly land on $p^2$s when iterating palindromes.

I've observed that each number base $b\ge10$ has one smallest gap which repeats between other unique gaps. That gap is always:

$$ g_0= b^2 + 3 b + 4 $$

Thus lets only observe the nontrivial gaps and denote the $k^{\text{th}}$ such gap with $g_k$.



Gap $1$

I believe I've found the patterns to the first gap:

For number bases $(b=2\dots34)$ I have computed the sizes of the first gap:

 0, 67, 43, 503, 1986, 1953, 11375, 3448, 25678, 34359, 45878, 64958, 70156, 5272, 111102, 1062, 175244, 212989, 256885, 310741, 367115, 431413, 503739, 584729, 674285, 763967, 873321, 1000468, 1127673, 1253127, 1409964, 1582265, 1769818

Then for number bases $(b=35\dots48)$, we can get the first gap using following expressions:

$$ g_1(b) = \begin{cases} 3939 n^4 + 11330 n^3 + 911097 n^2 + 5806354 n + 17285844, & \text{$b=32+3n$} \\ - 127 n^4 + 29350 n^3 + 392617 n^2 + 3298772 n + 9622146, & \text{$b=33+3n$} \\ n^3 + 216972 n^2 + 1768636 n + 5397267 , & \text{$b=34+3n$} \end{cases} $$

The next pattern is in $(b=49\dots62)$, given by:

$$ g_1(b) = \begin{cases} 16 n^4 + 1596 n^3 + 59626 n^2 + 988940 n + 6144706, & \text{$b=47+2n$} \\ 16 n^4 + 1628 n^3 + 62046 n^2 + 1049870 n + 6655509, & \text{$b=48+2n$} \end{cases} $$

The following pattern is in $(b=63\dots92)$, given by:

$$ g_1(b) = b^4+12b^3+b^2-39b-59 $$

Next we have (the final pattern?) for $(b\ge93)$, the following:

$$ g_1(b) = b^4+12b^3+34b^2+60b+74 $$

This was verified palindrome-by-palindrome up to $115$, and verified under assumption that the next gap is always bigger than previous, up to $300$. This leads me to believe that this last pattern holds for all number bases $b\ge93$.


Gap $2$

After the first gap comes the first $p^2$, then we have multiple consecutive gaps of size $g_0$ and some $p^2$s between them (the bigger the base, the more $g_0$'s). Then comes the gap $g_2$. I also believe to have found the pattern for this gap:

For first number bases $(b=2\dots92)$ I have computed the gaps $g_2(b)=$

 0, 0, 458, 30, 0, 7277, 2078, 15474, 538, 634, 2056, 33914, 2907, 87573, 5259, 136771, 1127, 824, 3758, 17833, 19999, 17513, 5270, 10589, 12158, 10584, 6074, 39244, 6926, 20138, 22517, 25070, 26541, 78787, 60625, 35657, 39092, 39451, 43144, 45245, 47396, 49597, 53920, 56313, 61016, 63609, 68708, |66406, 69059, 74522, 77385, 83274, 89437, 95880, 99301, 109630, 113407, 120910, 128721, 136846, 141257, 154062, 158873, 168182, 177833, 187832, 193353, 208898, 214863, 226170, 237853, 249918, 153955, 163913, 168225, 172593, 183339, 187979, 192677, 204241, 209221, 214261, 226673, 232005, 237399, 250689, 256385, 262145, 276343, 282415, 288553

I believe there are patterns among these like the patterns for bases $b\lt92$ in gaps $g_1$.

Then we have patterns for $(b=93\dots140)$, as follows:

$$ g_2(b) = \begin{cases} 2 (24 n^3 + 1614 n^2 + 36184 n + 270429), & \text{$b=89+4n$} \\ 2 (24 n^3 + 1626 n^2 + 36721 n + 276436) , & \text{$b=90+4n$} \\ 2 (24 n^3 + 1646 n^2 + 37631 n + 286788) , & \text{$b=91+4n$} \\ 4 (12 n^3 + 833 n^2 + 19276 n + 148696) , & \text{$b=92+4n$} \end{cases} $$

And patterns which I believe to hold for all $(b\ge141)$, below:

$$ g_2(b) = \begin{cases} 4 (4 n^3 + 497 n^2 + 20033 n + 263850) , & \text{$b=137+4n$} \\ 2 (8 n^3 + 998 n^2 + 40425 n + 535346) , & \text{$b=138+4n$} \\ 2 (8 n^3 + 1002 n^2 + 40785 n + 543047) , & \text{$b=139+4n$} \\ 2 (8 n^3 + 1014 n^2 + 41712 n + 560815) , & \text{$b=140+4n$} \end{cases} $$

This was verified up to base $400$ and at that point I was convinced the pattern won't change anymore. This was also assuming every next gap is larger than previous (by this I mean I can skip terms equal to the previous gap when checking), as all patterns so far suggest for larger bases. (notice this is not true for small bases, see computed examples where some gaps jump up and down, due to patterns not being "stabilized" yet)



Gap $k$?

I could compute examples for some gap $k$ in number bases $b\gt X$ where $X$ is some big number base where we have the last pattern, and then try to fit them into polynomial equations like it was possible for $g_1$ and $g_2$.

But can these final patterns be reached algebraically or be generated? This would make things much easier. (Also, knowing $X$ for some $g_k$ helps)

And what about the patterns for bases $b\le X$? How can we find those patterns without needing to compute and check almost every palindrome?

And looking at the small bases for first two gaps, is there actually a pattern to these or we have no choice but to check every palindrome to make sure we haven't jumped over some $p^2$?


You can download 9.html from my google drive and see all gaps for first $55$ number bases. (It is not .txt since a text file breaks lines. Download and open it in browser to be able to scroll around nicely without broken lines.)

(Would've posted it here as code but the character limit is beyond exceeded)

The other file contains all gaps for first $222$ number bases but only up to the $g_3$ which itself is marked with [?] as the first two gaps (and trivial gaps bewteen them) were being computed only.

(Trivial gaps are marked by * after them)

I can perhaps tidy up my python code and post it if you wish to compute more/other gaps like that. (I used wolfram alpha to fit computed results into polynomials and verify them for more terms)



P.S. All this here is one approach towards solving $P_9$ by osberving gaps bewteen palindromes, which here represents solutions for $p^2$'s of nine digits.


Taking a second look, is it possible to have an algorithm that if you give it base $b$ and some $k$, it outputs at least some lower bound for gap $g_k$ (if $b\lt X$ for that $k$, otherwise the final pattern should exist, thus it finds and uses that) ?

Vepir
  • 12,516

0 Answers0