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.

Showing 1-2 of 2 results.

A033274 Primes that do not contain any other prime as a proper substring.

Original entry on oeis.org

2, 3, 5, 7, 11, 19, 41, 61, 89, 101, 109, 149, 181, 401, 409, 449, 491, 499, 601, 691, 809, 881, 991, 1009, 1049, 1069, 1481, 1609, 1669, 1699, 1801, 4001, 4049, 4481, 4649, 4801, 4909, 4969, 6091, 6469, 6481, 6869, 6949, 8009, 8069, 8081, 8609, 8669, 8681
Offset: 1

Views

Author

Keywords

Comments

If there is more than one digit, all digits must be nonprime numbers.
A179335(n) = prime(n) iff prime(n) is in this sequence. For n > 4, prime(n) is in this sequence iff A109066(n) = 0. - Reinhard Zumkeller, Jul 11 2010, corrected by M. F. Hasler, Aug 27 2012
A079066(n) = 0 iff prime(n) is in this sequence. [Corrected by M. F. Hasler, Aug 27 2012]
What are the asymptotics of this sequence? - Charles R Greathouse IV, Aug 27 2012

Examples

			149 is a term as 1, 4, 9, 14, 49 are all nonprimes.
199 is not a term as 19 is a prime.
		

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a033274 n = a033274_list !! (n-1)
    a033274_list = map (a000040 . (+ 1)) $ elemIndices 0 a079066_list
    -- Reinhard Zumkeller, Jul 19 2011
    
  • Mathematica
    f[n_] := Block[ {id = IntegerDigits@n}, len = Length@ id - 1; Count[ PrimeQ@ Union[ FromDigits@# & /@ Flatten[ Table[ Partition[ id, k, 1], {k, len}], 1]], True] + 1]; Select[ Prime@ Range@ 1100, f@# == 1 &] (* Robert G. Wilson v, Aug 01 2010 *)
    Select[Prime[Range[1100]],NoneTrue[Flatten[Table[FromDigits/@Partition[IntegerDigits[#],d,1],{d,IntegerLength[#]-1}]],PrimeQ]&] (* Harvey P. Dale, Apr 19 2025 *)
  • Python
    from sympy import isprime
    def ok(n):
        if n in {2, 3, 5, 7}: return True
        s = str(n)
        if set(s) & {"2", "3", "5", "7"} or not isprime(n): return False
        ss2 = set(s[i:i+l] for i in range(len(s)-1) for l in range(2, len(s)))
        return not any(isprime(int(ss)) for ss in ss2)
    print([k for k in range(9000) if ok(k)]) # Michael S. Branicky, Jun 29 2022

Extensions

Edited by N. J. A. Sloane at the suggestion of Luca Colucci, Apr 03 2008

A089771 Largest n-digit prime containing no prime substrings, or 0 if no such prime exists.

Original entry on oeis.org

7, 89, 991, 9949, 99469, 996649, 9999481, 99990091, 999996901, 9999988049, 99999981469, 999999946849, 9999999946009, 99999999904081, 999999999946069, 9999999999944869, 99999999999884081, 999999999999984469, 9999999999999968869, 99999999999999900049, 999999999999999944009, 9999999999999999999869
Offset: 1

Views

Author

Amarnath Murthy, Nov 23 2003

Keywords

Comments

Conjecture: No term is zero.

Crossrefs

Programs

  • Maple
    cbd:= proc(n)
      local x,L,i,flag;
      L:= convert(n,base,10);
      x:= n;
      for i from nops(L) to 1 by -1 do
        if member(L[i],{2,3,5,7}) then
          flag:= true;
          if L[i] = 3 then x:= x - 10^(i-1)- (x mod 10^(i-1)) -1 else x:= x - (x mod 10^(i-1)) - 1 fi;
          return x
        fi;
      od;
     x
    end proc:
    nps:= proc(n) option remember;
      if n <= 10 then not isprime(n)
      else not isprime(n) and nps(floor(n/10)) and nps(n mod 10^ilog10(n))
      fi
    end proc:
    npps:= proc(n) local L,i,t;
      if n <= 10 then true
      else
        if n::odd then return nps(floor(n/10)) and nps(n mod 10^ilog10(n)) fi;
        for i from 1 do
          t:= floor(n/10^i);
          if t::odd then return nps(t) and nps(t mod 10^ilog10(t))
          elif t = 0 then return true
      fi od fi
    end proc:
    g:= proc(n) local p,i,x;
      p:= 10^n;
      do
        p:= prevprime(p);
        x:= cbd(p);
        while x <> p do
          p:= prevprime(x+1);
          x:= cbd(p)
        od;
        if npps(p) then return p fi
      od
    end proc:
    g(1):= 7:
    map(g, [$1..30]); # Robert Israel, Aug 30 2024
  • Python
    from sympy import isprime
    from itertools import product
    def c(s): return not any(isprime(int(s[i:j])) for i in range(len(s)-1, -1, -1) for j in range(len(s), i, -1) if (i, j) != (0, len(s)))
    def a(n):
        if n == 1: return 7
        return next(t for p in product("986410", repeat=n-1) for last in "91" if isprime(t:=int(s:="".join(p)+last)) and c(s))
    print([a(n) for n in range(1, 23)]) # Michael S. Branicky, Aug 30 2024

Extensions

More terms from David Wasserman, Oct 12 2005
More terms from Robert Israel, Aug 30 2024
Showing 1-2 of 2 results.