OFFSET
1,2
COMMENTS
Here is the 4-step routine:
(1) Start with any integer > 0
(2) Add 1 and print
(3) If the result is a composite number go to (2), else go to (4)
(4) Reverse the digits of the result and go to (2)
This routine keeps adding 1 to an integer, until the result is a prime number; then the digits of the prime number are reversed and the routine goes on. With this simple rule, no leading-zero problem will ever occur.
Jean-Marc Falcoz noticed that all integers < 1000000 will end sooner or later into a loop. Might there exist an integer with a different fate?
As we don't want duplicate terms, this sequence ends with its 143th term, which is 809; the next one (909) is already in the sequence.
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..143
EXAMPLE
The term after a(12) = 12 will be a(13) = 13 as 12 + 1 = 13 ; then 13, being a prime number, will be reversed in 31 and augmented by 1, which will produce the next term, a(14) = 32
PROG
(PARI) terms(n) = my(x=1, i=0); while(1, if(i==n, break); print1(x, ", "); i++; if(!ispseudoprime(x), x++, x=eval(concat(Vecrev(Str(x))))+1))
/* Print initial 70 terms as follows */
terms(70) \\ Felix Fröhlich, Jan 06 2019
CROSSREFS
KEYWORD
base,nonn,fini,easy
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Jan 05 2019
STATUS
approved