The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A326344 a(1) = 1. Thereafter, if n is prime, a(n) is the next prime after a(n-1), but written backwards. If n is not prime, a(n) is the next composite after a(n-1), 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 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.
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 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
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
For records see A326298 and A326402.
Cf. A000027 (the positive integers: this sequence without the digit-reversal, 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.
Sequence in context: A342829 A247796 A355370 * A340270 A115026 A360075
KEYWORD
nonn,base,nice
AUTHOR
Max Tohline, Sep 11 2019
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 7 02:59 EDT 2024. Contains 373140 sequences. (Running on oeis4.)