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.

A297960 a(1) = number of 1-digit primes (that is, 4: 2,3,5,7); then a(n) = number of distinct n-digit prime numbers obtained by alternately right- and left-concatenating a digit to the a(n-1) primes obtained in the previous iteration.

This page as a plain text file.
%I A297960 #50 Apr 11 2021 11:59:10
%S A297960 4,9,30,49,99,74,101,71,72,35,28,9,4
%N A297960 a(1) = number of 1-digit primes (that is, 4: 2,3,5,7); then a(n) = number of distinct n-digit prime numbers obtained by alternately right- and left-concatenating a digit to the a(n-1) primes obtained in the previous iteration.
%C A297960 No 14-digit numbers can be obtained from the four 13-digit numbers counted by a(13).
%e A297960 1-digit   2-digit   3-digit    4-digit   ...  13-digit
%e A297960 ------------------------------------------------------------
%e A297960 2         23        223        2237
%e A297960                                2239
%e A297960                     523        5231
%e A297960                                5233
%e A297960                                5237
%e A297960                     823        8231
%e A297960                                8233            6638182333331
%e A297960                                8237
%e A297960           29        229        2293
%e A297960                                2297
%e A297960                     829        8291
%e A297960                                8293
%e A297960                                8297
%e A297960                     929        9293
%e A297960 3         31        131        1319
%e A297960                     331        3313
%e A297960                                3319
%e A297960                     431
%e A297960                     631        6311            5981563119937
%e A297960                                6317
%e A297960           37        137        1373
%e A297960                     337        3371
%e A297960                                3373
%e A297960                     937        9371
%e A297960                                9377
%e A297960 5         53        353        3533
%e A297960                                3539
%e A297960                     653
%e A297960                     853        8537
%e A297960                                8539
%e A297960                     953        9533
%e A297960                                9539
%e A297960           59        359        3593
%e A297960                     659        6599
%e A297960                     859        8597
%e A297960                                8599
%e A297960 7         71        271        2711
%e A297960                                2713
%e A297960                                2719
%e A297960                     571        5711
%e A297960                                5717
%e A297960                     971        9719
%e A297960           73        173        1733
%e A297960                     373        3733
%e A297960                                3739
%e A297960                     673        6733            8313667333393
%e A297960                                6737
%e A297960                     773
%e A297960           79        179
%e A297960                     379        3793            2682637937713
%e A297960                                3797
%e A297960                     479        4793
%e A297960                                4799
%e A297960 ------------------------------------------------------------
%e A297960 a(1) = 4, a(2) = 9, a(3) = 30, a(4) = 49, ..., a(13) = 4.
%t A297960 Block[{b = 10, t}, t = Select[Range[b], CoprimeQ[#, b] &]; TakeWhile[Length /@ Fold[Function[{a, n}, Append[a, If[OddQ[n], Join @@ Map[Function[k, Select[Map[Prepend[k, #] &, Range[9]], PrimeQ@ FromDigits[#, b] &]], Last[a]], Join @@ Map[Function[k, Select[Map[Append[k, #] &, t], PrimeQ@ FromDigits[#, b] &]], Last[a]]]]] @@ {#1, #2} &, {IntegerDigits[Prime@ Range@ PrimePi@b, b]}, Range[2, 16]], # > 0 &]] (* _Michael De Vlieger_, Jan 20 2018 *)
%o A297960 (Python)
%o A297960 from sympy import isprime
%o A297960 def alst():
%o A297960   primes, alst = [2, 3, 5, 7], []
%o A297960   while len(primes) > 0:
%o A297960     alst.append(len(primes))
%o A297960     if len(alst)%2 == 0:
%o A297960       candidates = set(int(d+str(p)) for p in primes for d in "123456789")
%o A297960     else:
%o A297960       candidates = set(int(str(p)+d) for p in primes for d in "1379")
%o A297960     primes = [c for c in candidates if isprime(c)]
%o A297960   return alst
%o A297960 print(alst()) # _Michael S. Branicky_, Apr 11 2021
%Y A297960 Cf. A050986, A050987, A297961, A298048.
%K A297960 nonn,full,base,fini
%O A297960 1,1
%A A297960 _Seiichi Manyama_, Jan 09 2018