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.

Original entry on oeis.org

11, 149, 1181, 11119, 111119, 1111169, 11111119, 111111181, 1111111181, 11111111449, 111111111149, 1111111111441, 11111111111411, 111111111111691, 1111111111111181, 11111111111111119, 111111111111111161
Offset: 2

Views

Author

Ray G. Opao, Mar 22 2005

Keywords

Programs

  • Maple
    f:= proc(n) local t,x,L,y;
      t:= (10^n-1)/9;
      for x from 0 to 5^n-1 do
        L:= subs({1=3, 2=5, 3=7, 4=8},convert(x,base,5));
        y:= t+add(10^(i-1)*L[i],i=1..nops(L));
        if isprime(y) then return y fi
      od;
      FAIL
    end proc:
    map(f, [$2..20]); # Robert Israel, Sep 28 2018
  • Mathematica
    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 *)
    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 *)
  • Python
    from sympy import isprime
    from itertools import product
    def a(n):
        for p in product("14689", repeat=n):
            t = int("".join(p))
            if isprime(t): return t
    print([a(n) for n in range(2, 22)]) # Michael S. Branicky, Aug 20 2022

Extensions

More terms from Robert G. Wilson v, Mar 23 2005