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.

A232125 Smallest prime such that the n numbers obtained by removing 1 digit on the right are also prime, while no digit can be added on the right to get another prime.

This page as a plain text file.
%I A232125 #20 Aug 23 2021 13:37:08
%S A232125 53,53,317,2393,23333,373393,2399333,23399339,1979339333,103997939939,
%T A232125 4099339193933,145701173999399393,2744903797739993993333,
%U A232125 52327811119399399313393,13302806296379339933399333
%N A232125 Smallest prime such that the n numbers obtained by removing 1 digit on the right are also prime, while no digit can be added on the right to get another prime.
%C A232125 Inspired by article on 43 in Archimedes' Lab link.
%H A232125 G. A. Sarcone and M. J. Waeber, <a href="http://www.archimedes-lab.org/numbers/Num24_69.html">What's Special About This Number?</a>, Archimedes' Lab website.
%e A232125 a(0)=53 because 53 is the smallest prime such that all numbers obtained by adding a digit to the right are composite.
%e A232125 a(1)=53 because 5 and 53 are primes.
%e A232125 a(2)=317 because 3, 31, 317 are all primes, and 317 has the same property as 53 when adding a digit to the right.
%o A232125 (PARI) a(n) = {n++; v = vector(n); i = 1; ok = 0; until (ok, while ((i>1) && (v[i] == 9), v[i] = 0; i--); if (i == 1, v[i] = nextprime(v[i]+1), v[i] = v[i]+1); curp = sum (j=1, i, v[j]*(10^(i-j))); if (isprime(curp), if (i != n, i++, nbp = 0; for (z=1, 9, if (isprime(10*curp+z), nbp++);); if (nbp == 0, ok = 1);););); sum (j=1, n, v[j]*(10^(n-j)));}
%o A232125 (Python)
%o A232125 from sympy import isprime, nextprime
%o A232125 def a(n):
%o A232125     p, oo = 2, float('inf')
%o A232125     while True:
%o A232125         extends, reach, r1 = 0, [str(p)], []
%o A232125         while len(reach) > 0 and extends <= n:
%o A232125             minnotext = oo
%o A232125             for s in reach:
%o A232125                 wasextended = False
%o A232125                 for d in "1379":
%o A232125                     if isprime(int(s+d)): r1.append(s+d); wasextended = True
%o A232125                 if not wasextended: minnotext = min(minnotext, int(s))
%o A232125             if extends == n and minnotext < oo: return minnotext
%o A232125             if len(r1) > 0: extends += 1
%o A232125             reach, r1 = r1, []
%o A232125         p = nextprime(p)
%o A232125 for n in range(12): print(a(n), end=", ") # _Michael S. Branicky_, Aug 08 2021
%Y A232125 Cf. A024770, A119289, A227919, A239747.
%K A232125 nonn,base,more
%O A232125 0,1
%A A232125 _Michel Marcus_, Nov 19 2013
%E A232125 a(12)-a(13) from _Michael S. Branicky_, Aug 08 2021
%E A232125 a(14) from _Michael S. Branicky_, Aug 23 2021