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.

A103544 Least n-digit zeroless prime with nonprime digits.

This page as a plain text file.
%I A103544 #16 Aug 20 2022 13:38:05
%S A103544 11,149,1181,11119,111119,1111169,11111119,111111181,1111111181,
%T A103544 11111111449,111111111149,1111111111441,11111111111411,
%U A103544 111111111111691,1111111111111181,11111111111111119,111111111111111161
%N A103544 Least n-digit zeroless prime with nonprime digits.
%H A103544 Robert Israel, <a href="/A103544/b103544.txt">Table of n, a(n) for n = 2..999</a>
%p A103544 f:= proc(n) local t,x,L,y;
%p A103544   t:= (10^n-1)/9;
%p A103544   for x from 0 to 5^n-1 do
%p A103544     L:= subs({1=3, 2=5, 3=7, 4=8},convert(x,base,5));
%p A103544     y:= t+add(10^(i-1)*L[i],i=1..nops(L));
%p A103544     if isprime(y) then return y fi
%p A103544   od;
%p A103544   FAIL
%p A103544 end proc:
%p A103544 map(f, [$2..20]); # _Robert Israel_, Sep 28 2018
%t A103544 NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; f[n_] := Block[{np = NextPrim[(10^n - 1)/9 - 1]}, While[ Union[ Join[{1, 4, 6, 8, 9}, IntegerDigits[np]]] != {1, 4, 6, 8, 9}, np = NextPrim[np]]; np]; Table[ f[n], {n, 2, 18}] (* _Robert G. Wilson v_, Mar 23 2005 *)
%t A103544 ndzp[n_]:=Module[{np=NextPrime[FromDigits[PadRight[{},n,1]]]},While[ !SubsetQ[ {1,4,6,8,9},IntegerDigits[ np]],np =NextPrime[np]];np]; Join[{11},Array[ndzp,16,3]] (* _Harvey P. Dale_, Aug 28 2021 *)
%o A103544 (Python)
%o A103544 from sympy import isprime
%o A103544 from itertools import product
%o A103544 def a(n):
%o A103544     for p in product("14689", repeat=n):
%o A103544         t = int("".join(p))
%o A103544         if isprime(t): return t
%o A103544 print([a(n) for n in range(2, 22)]) # _Michael S. Branicky_, Aug 20 2022
%K A103544 base,nonn
%O A103544 2,1
%A A103544 _Ray G. Opao_, Mar 22 2005
%E A103544 More terms from _Robert G. Wilson v_, Mar 23 2005