World!Of
Numbers

WON plate
|

[ January 9, 2022 ]
Building sequences out of concatenated palindromes
Patrick De Geest

We start from 1 and string together the next palindrome to it,
thus building larger and larger numbers. With each palindrome
added to the chain we check for its primeness or pseudoprimeness.

For the  ascending case  I soon discovered manually these two nice primes !

12345678911223344556677
and
123456789112233445566778899101

Is this a rare and lonely couple  77  and  101  ?
If there is a third prime the last palindrome must be larger than 10,000,000.
With each term added the numbers expands with twice the length of the last
palindrome added. Furthermore our candidate can only end with 1, 3, 7 or 9.
So you will understand why our third prime will be a very lucky shot indeed.

This is how I tackle the topic. I use Pari/gp
to make a file ('Smpal.txt') with all the candidates in it.

{
cnt=0; x=[];
for(i=1,10000000,
   p=digits(i);marque=0;ld=p[length(p)];
   if(Vecrev(p)==p, x=concat(x,p); cnt+=1; marque=1; );
   if((ld==1||ld==3||ld==7||ld==9)&&marque==1, print(cnt," ",i);
       write("C:/pari/Smpal.txt", fromdigits(x)); );
);
}

Then I pass the torch to 'Pfgw64' which will quickly determine
its status between composite and 3-PRP! Pari/gp also has a
function 'ispseudoprime()' but is very slow with large numbers.

pfgw64 "C:\pari\Smpal.txt"

and finally check the logfile ('pfgw.log') for any (pseudo)primes.



For the  descending case  I soon discovered manually these three nice primes !

1311211111019988... ... 332211987654321

494484474464454444... ...332211987654321

747737727717707696... ... 332211987654321

This looks like a nice but isolated (?) trio  131 ,  494  and  747 .

Here is the program with adaptations for the descending case.
No need to filter out 1, 3, 7 or 9 as this kind of numbers
always end with 1. This Pari/gp will create a file ('Rsmpal.txt')

{
cnt=0; x=[];
for(i=1,10000000,
   p=digits(i);marque=0;
   if(Vecrev(p)==p, x=concat(p,x); cnt+=1; marque=1; );
   if(marque==1, print(cnt," ",i); write("C:/pari/Rsmpal.txt", fromdigits(x)););
);
}

to be used thereafter by Pfgw64 for the actual (pseudo)prime search.

pfgw64 "C:\pari\Rsmpal.txt"

You only need to check now the logfile ('pfgw.log') for any results.

And the program already delivers! The fourth number is  82328 .
Up to the fifth (pseudo)prime in this sequence.
If there is a fifth PRP the first palindrome must be larger than 10,000,000.



Lastly there is the combined case of ascending towards
a middle term and then descending back to 1.

Let us call these palindromes  Palindache Numbers .

Here we are dealing with Palindromic (pseudo)Primes
hence I have to port you to palprim6.htm which is part
of a dedicated section dealing with PP's. See you there!




A000214 Prime Curios! Prime Puzzle
Wikipedia 214 Le nombre 214














[ TOP OF PAGE]


( © All rights reserved )

Patrick De Geest - Belgium - Short Bio - Some Pictures
E-mail address : pdg@worldofnumbers.com