OFFSET
1,2
COMMENTS
For all n > 1, a(n) > 0.
For all n > 3, if a(n) is even or odd, then until a new number a(n+k) > a(n), all a(n+k) must also be even or odd, respectively.
"Smallest allowed base" is max{a(1), a(2), ..., a(n)} + 1. E.g., a(3) uses base 3 because max{0, 2, 1} + 1 = 3.
Treat a(n) >= 10 as one "digit". E.g., if three consecutive terms were 8, 12, 4, treat the concatenation as "8C4" to be read in base 13 instead of "8124."
It is unknown whether this sequence has infinite terms. There exist initial values which, using the method described in the definition, reach a point that guarantees no new primes. E.g., Michael S. Branicky showed for a(1) = 13, after 4 terms {13, 9, 3, 5} the tested number for a fifth term "k" is not prime for 0 <= k < 13, and the equation for the tested number once k >= 13 is 13*(k+1)^4 + 9*(k+1)^3 + 3*(k+1)^2 + 5(k+1) + k = (k+2)(13*k^3 + 35*k^2 + 38*k + 15), thus never prime. Because there exist initial values which guarantee no new terms after various lengths, any initial value may eventually reach such a point.
LINKS
Samuel Harkness, Table of n, a(n) for n = 1..1309
EXAMPLE
For a(6): The concatenation a(1)a(2)a(3)a(4)a(5) gives 2122. The smallest base in which 2122 can be read is max{2, 1, 2, 2} + 1 = 3, so test 21220_3 = 213 (nonprime), 21221_3 = 214 (nonprime), 21222_3 = 215 (nonprime). Now, 21223 is the next candidate; note that the new smallest allowed base is max{2, 1, 2, 2, 3} + 1 = 4, so test 21223_4 = 619 (prime). Thus, a(6) = 3.
MATHEMATICA
V = {0}; While[Length[V] <= 60, c = 0; d = 0; b = Max[V] + 1; CCC = 0; While[c == 0, X = V; X = Append[X, d]; CCC = 0; For[i = 1, i <= Length[X], i++, CCC += Part[X, i]*b^(Length[X] - i)]; If[PrimeQ[CCC], c = 1]; d++; If[d == b, b++]]; V = X]; Print[V]
PROG
(Python)
from sympy import isprime
from itertools import count, islice
def fd(d, b): return sum(di*b**i for i, di in enumerate(d[::-1]))
def anext(alst):
b = max(alst)
return next(k for k in count(1) if isprime(fd(alst+[k], max(b, k)+1)))
def agen():
alst = [0]
while True: yield alst[-1]; alst.append(anext(alst))
print(list(islice(agen(), 61))) # Michael S. Branicky, Nov 11 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Samuel Harkness, Nov 11 2022
EXTENSIONS
Escape clause added by Jianing Song, Nov 28 2022
STATUS
approved