OFFSET
1,2
COMMENTS
The first two-digit a(n) occurs at n = 17. The first three-digit 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.
(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 non-maximal 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
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(n-1)), c(a(n-1))))))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Sep 12 2019
MATHEMATICA
ncp[{n_, a_}]:=Module[{k=1}, {n+1, If[PrimeQ[n+1], IntegerReverse[NextPrime[ a]], While[!CompositeQ[k+a], k++]; IntegerReverse[k+a]]}]; NestList[ncp, {1, 1}, 80][[All, 2]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Apr 05 2020 *)
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
KEYWORD
nonn,base,nice
AUTHOR
Max Tohline, Sep 11 2019
STATUS
approved