cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A358344 a(1) = 0; a(n) = the smallest number such that the concatenation a(1)a(2)...a(n) is prime in the smallest allowed base; sequence terminates at index m if a(1)a(2)...a(m)k is composite in the smallest allowed base for all k.

This page as a plain text file.
%I A358344 #24 Nov 28 2022 10:01:41
%S A358344 0,2,1,2,2,3,1,5,9,7,21,5,31,49,39,104,2,34,44,74,22,64,16,107,549,81,
%T A358344 207,273,87,497,27,556,42,150,32,44,144,340,28,198,677,13,61,209,377,
%U A358344 893,329,391,49,83,425,197,1017,205,191,163,1131,291,281,295,389
%N A358344 a(1) = 0; a(n) = the smallest number such that the concatenation a(1)a(2)...a(n) is prime in the smallest allowed base; sequence terminates at index m if a(1)a(2)...a(m)k is composite in the smallest allowed base for all k.
%C A358344 For all n > 1, a(n) > 0.
%C A358344 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.
%C A358344 "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.
%C A358344 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."
%C A358344 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.
%H A358344 Samuel Harkness, <a href="/A358344/b358344.txt">Table of n, a(n) for n = 1..1309</a>
%e A358344 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.
%t A358344 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]
%o A358344 (Python)
%o A358344 from sympy import isprime
%o A358344 from itertools import count, islice
%o A358344 def fd(d, b): return sum(di*b**i for i, di in enumerate(d[::-1]))
%o A358344 def anext(alst):
%o A358344     b = max(alst)
%o A358344     return next(k for k in count(1) if isprime(fd(alst+[k], max(b, k)+1)))
%o A358344 def agen():
%o A358344     alst = [0]
%o A358344     while True: yield alst[-1]; alst.append(anext(alst))
%o A358344 print(list(islice(agen(), 61))) # _Michael S. Branicky_, Nov 11 2022
%Y A358344 Cf. A023107, A024770, A069603.
%K A358344 base,nonn
%O A358344 1,2
%A A358344 _Samuel Harkness_, Nov 11 2022
%E A358344 Escape clause added by _Jianing Song_, Nov 28 2022