

A326344


a(1) = 1. Thereafter, if n is prime, a(n) is the next prime after a(n1), but written backwards. If n is not prime, a(n) is the next composite after a(n1), written backwards.


10



1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 4, 5, 6, 8, 9, 11, 21, 32, 33, 43, 44, 74, 57, 85, 68, 96, 89, 79, 8, 11, 21, 22, 42, 44, 54, 95, 69, 7, 8, 11, 21, 32, 33, 43, 44, 74, 57, 85, 68, 96, 89, 79, 8, 9, 1, 4, 6, 7, 8, 11, 21, 22, 42, 44, 54, 95, 69, 7, 8, 11, 21
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

The first twodigit a(n) occurs at n = 17. The first threedigit a(n) occurs at n = 643. According to Michel Marcus, in the first 10^8 terms, a(n) never exceeds 909. It is now known that this is the maximal value (see the Weimholt link).
Since prime gaps (A001223) do not become periodic, this sequence should not become periodic either, though several short series of terms (e.g., 11, 21, 22, 42, 44, 54, 95, 69) reappear frequently.
From Rémy Sigrist, Sep 12 2019: (Start)
For any n > 0:
 let c(n) be the next composite after n, read backwards,
 let p(n) be the next prime after n, read backwards.
Let C be the set defined by the following rules:
 2 belongs to C,
 if x belongs to C, then c(c(x)) and c(p(x)) also belong to C.
We can prove by program that the set C is finite.
Hence:
 for any even number n >= 2, a(n) <= max(C) = 939,
 for any odd number n >= 3, a(n) <= max({c(k), k in C} U {p(k), k in C}) = 938.
Hence the sequence is bounded, and A326298 and A326402 are finite.
(End)
From M. F. Hasler, Sep 13 2019: (Start)
Terms a(n) > 800 occur at indices (649, 3132, [3595], 3596, [6805], 6806, 7344, 8233, [8234], [11173], 11174, 12619, 13687, 14089, ...). (Subsequent indices are > 20000. Indices in [.] correspond to a nonmaximal value, i.e., a(n+1) > a(n).) The corresponding values are in the set {804, 806, 807, 808, 809, 904, 907} and occur as part of one of the following subsequences: (maxima starred)
a) (..., 66, 86, 98, 99, 101, 201, 202, 302, 703, 407, 804*, 508, 15, 61, 26, ...)
b) (..., 66, 86, 98, 99, 101, 201, 202, 302, 303, 403, 904*, 509, 15, 61, ...)
c) (..., 201, 202, 302, 303, 403, 404, 504, 505, 605, 606, 806*, 708, 17, 81, 28, 92, 39, ...)
d) (..., 302, 303, 403, 404, 504, 505, 605, 706, 707, 807, 808*, 18, 2, 4, 6, 8, 9, 1, 4, ...),
e) (..., 302, 303, 403, 404, 504, 505, 605, 706, 707, 907*, 809, 18, 2, 3, 4, 6, 8, 9, 1, ...).
(End)


LINKS

Max Tohline, Table of n, a(n) for n = 1..20000
Rémy Sigrist, PARI program that computes the set C described in comments
Andrew Weimholt, Proof that A326344 is bounded with a maximum value of 909


MAPLE

c:= n> (k> `if`(isprime(k), c(k), k))(n+1):
a:= proc(n) option remember; `if`(n=1, 1,
(s> parse(cat(s[i]$i=1..length(s))))(""(
`if`(isprime(n), nextprime(a(n1)), c(a(n1))))))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Sep 12 2019


PROG

(PARI) nextcompo(n) = while(isprime(n), n++); n;
lista(nn) = {my(a = 1); for (n=2, nn, print1(a, ", "); if (isprime(n), a = nextprime(a+1), a = nextcompo(a+1)); a = fromdigits(Vecrev(digits(a))); ); } \\ Michel Marcus, Sep 11 2019
(PARI) A326344_vec(N) = vector(N, n, N=A004086(if(n<=9, n, isprime(n), nextprime(N+1), N>3, N+2^isprime(N+1), 4))) \\ Next composite is N+1 if this is composite, else N+2 (unless N=1). A004086(n)=fromdigits(Vecrev(digits(n))).  M. F. Hasler, Sep 13 2019


CROSSREFS

For records see A326298 and A326402.
Cf. A000027 (the positive integers: this sequence without the digitreversal, as observed by Michel Marcus).
For analogs in bases 3, 6, and 7 see A326894, A327463, and A327241.
For analogs in bases 3,5,6,7,10 see A326894, A327464, A327463, A327241, A326344 = the present sequence.
Cf. A000040, A002808, A004086, A113646, A151800, A326892.
Sequence in context: A209685 A114570 A247796 * A115026 A101337 A135208
Adjacent sequences: A326341 A326342 A326343 * A326345 A326346 A326347


KEYWORD

nonn,base,nice


AUTHOR

Max Tohline, Sep 11 2019


STATUS

approved



