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.
%I A030665 #45 Jan 27 2025 22:51:58 %S A030665 11,23,31,41,53,61,71,83,97,101,113,127,131,149,151,163,173,181,191, %T A030665 2003,211,223,233,241,251,263,271,281,293,307,311,3203,331,347,353, %U A030665 367,373,383,397,401,419,421,431,443,457,461,479,487,491,503,5101 %N A030665 Smallest nontrivial extension of n which is prime. %C A030665 The argument in A069695 shows that a(n) always exists. - _N. J. A. Sloane_, Nov 11 2020 %H A030665 Chai Wah Wu, <a href="/A030665/b030665.txt">Table of n, a(n) for n = 1..10000</a> [T. D. Noe computed the first 1000 terms] %H A030665 Chai Wah Wu, <a href="http://arxiv.org/abs/1503.08883">On a conjecture regarding primality of numbers constructed from prepending and appending identical digits</a>, arXiv:1503.08883 [math.NT], 2015. %H A030665 <a href="/index/Pri#piden">Index entries for primes involving decimal expansion of n</a> %e A030665 For n = 1, we could append 1, 3, 7, 9, 01, etc., to make a prime, but 1 gives the smallest of these, 11, so a(1) = 11. %e A030665 For n = 2, although 2 is already prime, the definition requires an appending at least one digit. 1 doesn't work because 21 = 3 * 7, but 3 does because 23 is prime. Hence a(2) = 23. %p A030665 f:= proc(n) local x0, d, r, y; %p A030665 for d from 1 do %p A030665 x0:= n*10^d; %p A030665 for r from 1 to 10^d-1 by 2 do %p A030665 if isprime(x0+r) then %p A030665 return(x0+r) %p A030665 fi %p A030665 od %p A030665 od %p A030665 end proc: %p A030665 seq(f(n), n=1..100); # _Robert Israel_, Dec 23 2014 %t A030665 A030665[n_] := Module[{d = 10, nd = 10 * n}, While[True, x = NextPrime[nd]; If[x < nd + d, Return[x]]; d *= 10; nd *= 10]]; Array[A030665, 100] (* _Jean-François Alcover_, Oct 19 2016, translated from _Chai Wah Wu_'s Python code *) %o A030665 (Python) %o A030665 from sympy import nextprime %o A030665 def A030665(n): %o A030665 d, nd = 10, 10*n %o A030665 while True: %o A030665 x = nextprime(nd) %o A030665 if x < nd+d: %o A030665 return int(x) %o A030665 d *= 10 %o A030665 nd *= 10 # _Chai Wah Wu_, May 24 2016 %o A030665 (PARI) apply( {A030665(n)=my(p,L); until(n+10^L++>p=nextprime(n), n*=10);p}, [1..55]) \\ _M. F. Hasler_, Jan 27 2025 %Y A030665 Cf. A018800, A068695, A077501. %K A030665 nonn,base,nice %O A030665 1,1 %A A030665 _Patrick De Geest_ %E A030665 Corrected by _Ray Chandler_, Aug 11 2003