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-10 of 10 results.

A039997 Number of distinct primes which occur as substrings of the digits of n.

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 2, 0, 1, 0, 2, 0, 1, 1, 1, 1, 3, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 3, 1, 1, 0, 1, 1, 2, 0, 1, 0, 2, 0, 0, 1, 1, 2, 3, 1, 1, 1, 2, 1, 2, 0, 1, 1, 1, 0, 1, 0, 2, 0, 0, 1, 2, 2, 3, 1, 2, 1, 1, 1, 2, 0, 0, 1, 2, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 2, 0, 0, 0, 1, 1, 2, 0, 1
Offset: 1

Views

Author

Keywords

Examples

			a(22) = 1 because 22 has two substrings which are prime but they are identical. a(103) = 2, since the primes 3 and 103 occur as substrings.
		

Crossrefs

Different from A039995 after the 100th term. Cf. A035232.

Programs

  • Haskell
    import Data.List (isInfixOf)
    a039997 n = length [p | p <- takeWhile (<= n) a000040_list,
                            show p `isInfixOf` show n]
    a039997_list = map a039997 [1..]
    -- Reinhard Zumkeller, Jan 31 2012
    
  • Maple
    a:= n-> (s-> nops(select(t -> t[1]<>"0" and isprime(parse(t)),
            {seq(seq(s[i..j], i=1..j), j=1..length(s))})))(""||n):
    seq(a(n), n=1..100);  # Alois P. Heinz, Aug 09 2022
  • Mathematica
    a[n_] := Block[{s = IntegerDigits[n], c = 0, d = {}}, l = Length[s]; t = Flatten[ Table[ Take[s, {i, j}], {i, 1, l}, {j, i, l}], 1]; k = l(l + 1)/2; While[k > 0, If[ t[[k]][[1]] != 0, d = Append[d, FromDigits[ t[[k]] ]]]; k-- ]; Count[ PrimeQ[ Union[d]], True]]; Table[ a[n], {n, 1, 105}]
  • PARI
    dp(n)=if(n<12,return(if(isprime(n),[n],[])));my(v=vecsort(select(isprime, eval(Vec(Str(n)))),,8),t);while(n>9,if(gcd(n%10,10)>1,n\=10;next);t=10; while((t*=10)Charles R Greathouse IV, Jul 10 2012
    
  • Python
    from sympy import isprime
    def a(n):
        s = str(n)
        ss = (int(s[i:j]) for i in range(len(s)) for j in range(i+1, len(s)+1))
        return len(set(k for k in ss if isprime(k)))
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Aug 07 2022

Formula

a(A062115(n)) = 0; a(A093301(n)) = n and a(m) <> n for m < A093301(n). - Reinhard Zumkeller, Jul 16 2007
a(A163753(n)) > 0; a(A205667(n)) = 1. [Reinhard Zumkeller, Jan 31 2012]

Extensions

Edited by Robert G. Wilson v, Feb 24 2003

A068669 Noncomposite numbers in which every substring is noncomposite.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 13, 17, 23, 31, 37, 53, 71, 73, 113, 131, 137, 173, 311, 313, 317, 373, 1373, 3137
Offset: 1

Views

Author

Amarnath Murthy, Mar 02 2002

Keywords

Comments

It is easy to see that this sequence is complete - the only potential 5-digit candidate 31373 is not prime. - Tanya Khovanova, Dec 09 2006

Examples

			137 is a member as all the substrings, i.e. 1, 3, 7, 13, 37, 137, are noncomposite.
All substrings of 3137 are noncomposite numbers: 1, 3, 7, 13, 37, 137, 313, 3137. - _Jaroslav Krizek_, Dec 25 2011
		

Crossrefs

Programs

  • Mathematica
    noncompositeQ[n_] := n == 1 || PrimeQ[n]; Reap[ Do[ id = IntegerDigits[n]; lid = Length[id]; test = And @@ noncompositeQ /@ FromDigits[#, 10]& /@ Flatten[ Table[ Take[id, {i, j}], {i, 1, lid}, {j, i, lid}], 1]; If[test, Sow[n]], {n, Join[{1}, Prime /@ Range[10000]]}]][[2, 1]](* Jean-François Alcover, May 09 2012 *)

Extensions

1 added following a redefinition by Jaroslav Krizek. - R. J. Mathar, Jan 20 2012

A202262 Composite numbers in which all substrings are composite.

Original entry on oeis.org

4, 6, 8, 9, 44, 46, 48, 49, 64, 66, 68, 69, 84, 86, 88, 94, 96, 98, 99, 444, 446, 448, 464, 466, 468, 469, 484, 486, 488, 494, 496, 498, 644, 646, 648, 649, 664, 666, 668, 669, 684, 686, 688, 694, 696, 698, 699, 844, 846, 848, 849, 864, 866, 868, 869, 884, 886
Offset: 1

Views

Author

Jaroslav Krizek, Dec 25 2011

Keywords

Comments

Subsequence of A062115, A202260, A029581.
Supersequence of A202265.
This is a 10-automatic sequence, see A071062. - Charles R Greathouse IV, Jan 01 2012

Crossrefs

Cf. A085823 (primes in which all substrings are primes), A068669 (noncomposite numbers in which all substrings are noncomposite), A062115 (nonprimes in which all substrings are nonprimes).
Cf. A010051.

Programs

  • Mathematica
    sub[n_] := Block[{d = IntegerDigits[n]}, Union@ Reap[ Do[Sow@ FromDigits@ Take[d, {i, j}], {j, Length@ d}, {i, j}]][[2, 1]]]; Select[ Range@ 900, Union[{4, 6, 8, 9}, IntegerDigits[#]] == {4, 6, 8, 9} && AllTrue[sub[#], CompositeQ] &] (* Giovanni Resta, Dec 20 2019 *)
  • PARI
    See Links section.

Extensions

Data corrected by Reinhard Zumkeller, May 05 2012
Data corrected by Rémy Sigrist, Dec 19 2019
Incorrect Haskell program deleted by M. F. Hasler, Dec 20 2019

A202265 Nonprime numbers in which all substrings and reversal substrings are nonprimes.

Original entry on oeis.org

0, 1, 4, 6, 8, 9, 10, 18, 40, 44, 46, 48, 49, 60, 64, 66, 68, 69, 80, 81, 84, 86, 88, 90, 94, 96, 99, 100, 108, 180, 184, 186, 400, 404, 406, 408, 440, 444, 446, 448, 460, 464, 466, 468, 469, 480, 481, 484, 486, 488, 490, 494, 496, 600, 604, 606, 608, 609
Offset: 1

Views

Author

Jaroslav Krizek, Dec 25 2011

Keywords

Comments

Subsequence of A062115, A202259.
Supersequence of A202266.

Examples

			All substrings and reversal substrings of 186 are nonprimes: 1, 6, 8, 18, 68, 81, 86, 186, 681.
		

Crossrefs

Cf. A202263 (primes in which all substrings and reversal substrings are primes), A068669 (noncomposite numbers in which all substrings and reversal substrings are noncomposites), A202266 (composite numbers in which all substrings and reversal substrings are composites).

Programs

  • Mathematica
    Select[Range[0,1000],NoneTrue[Union[Flatten[{#,IntegerReverse[#]}&/@Flatten[Table[ FromDigits/@Partition[IntegerDigits[#],d,1],{d,IntegerLength[#]}]]]],PrimeQ]&] (* Harvey P. Dale, Jul 30 2024 *)

Extensions

Corrected (498 deleted) by Harvey P. Dale, Jul 30 2024

A163753 At least one prime occurs as a substring of the digits of n.

Original entry on oeis.org

2, 3, 5, 7, 11, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 45, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 65, 67, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 82, 83, 85, 87, 89, 92, 93, 95, 97, 101, 102
Offset: 1

Views

Author

Gil Broussard, Aug 03 2009

Keywords

Comments

A039997(a(n)) > 0. - Reinhard Zumkeller, Jan 31 2012
This sequence (written in decimal) is automatic in the terminology of Allouche & Shallit since A071062 is finite. - Charles R Greathouse IV, Jan 31 2012

Examples

			a(6) = 12 because "2" is a prime substring of "12".
		

Crossrefs

Cf. A062115 (complement), A205667 (subsequence), A071062.

Programs

  • Haskell
    a163753 n = a163753_list !! (n-1)
    a163753_list = filter ((> 0) . a039997) [0..]
    -- Reinhard Zumkeller, Jan 31 2012

A211396 Smallest prime substring of n, or 0 if no such substring exists.

Original entry on oeis.org

0, 0, 2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 2, 3, 0, 5, 0, 7, 0, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 0, 41, 2, 3, 0, 5, 0, 7, 0, 0, 5, 5, 2, 3, 5, 5, 5, 5, 5, 5, 0, 61, 2, 3, 0, 5, 0, 7, 0, 0, 7, 7, 2, 3, 7, 5, 7, 7, 7, 7, 0, 0, 2, 3, 0, 5
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 08 2013

Keywords

Comments

a(n) <= A047814(n);
a(n) = 0 iff A039997(n) = 0, cf. A062115;
a(n) = n iff n is prime and A039997(n) = 1.

Programs

  • Haskell
    import Data.List (isInfixOf)
    a211396 n = if null ips then 0 else head ips
       where ips = [p | p <- takeWhile (<= n) a000040_list,
                        show p `isInfixOf` show n]

A318708 Terms resulting from application of a prime sieve to the digits of the decimal expansions of the positive integers.

Original entry on oeis.org

1, 4, 6, 8, 9, 10, 1, 1, 14, 1, 16, 1, 18, 0, 1, 4, 6, 8, 9, 0, 1, 4, 6, 8, 9, 40, 4, 4, 44, 4, 46, 4, 48, 49, 0, 1, 4, 6, 8, 9, 60, 6, 6, 64, 6, 66, 6, 68, 69, 0, 1, 4, 6, 8, 9, 80, 81, 8, 8, 84, 8, 86, 8, 88, 90, 91, 9, 9, 94, 9, 96, 9, 98, 99, 100, 10, 10, 104, 10, 106, 10, 108, 0, 1, 4
Offset: 1

Views

Author

Ctibor O. Zizka, Sep 01 2018

Keywords

Comments

Definition of sieving over the digits of k: Erase each digit 2 in the decimal expansion of k, then consolidate the remaining digits. Erase each digit 3 in what remains from the previous step, then consolidate the remaining digits. Repeat the procedure with 5, 7, ..., largest prime <= last consolidated remainder. What remains then becomes a term of the sequence. If there are no remaining digits after the procedure, this number disappears and is not a term.
Consolidation means the removal of all empty places at each step of the sieving process. Example: k = 1225; erasing all 2's in 1225 results in 1__5, which consolidates to 15; erasing all 3's in 15 results in 15; erasing all 5's in 15 results in 1_, which consolidates to 1. So for k = 1225 the result after sieving is 1. Example: k = 10101; erasing all 2's, ..., 97's results in 10101; erasing 101's in 10101 results in ___01, which consolidates to the last consolidated remainder 01. As there is no prime <= 01 to sieve with, the result for k = 10101 after sieving is 1.
Largest number of a sieve <= last consolidated remainder.
This sequence sieve is: {primes}. There could be other sieve definitions: {binary numbers}, {even numbers}, {odd numbers}, {triangular numbers}, predefined set of numbers like {0,3,11,27}, etc.

Examples

			n = 113
p_1 = 2, no occurrence of 2 in 113
p_2 = 3, 1 occurrence of 3 in 113, erase 3, remains 11
p_3 = 5, no occurrence of 5 in 11
p_4 = 7, no occurrence of 7 in 11
p_5 = 11, 1 occurrence of 11 in 11, no remainder
number 113 disappears and is not a member of the seq.
n = 114
p_1 = 2, no occurrence of 2 in 114
p_2 = 3, no occurrence of 3 in 114
p_3 = 5, no occurrence of 5 in 114
p_4 = 7, no occurrence of 7 in 114
p_5 = 11, 1 occurrence of 11 in 114, erase 11, remains 4
number 4 is a member of the seq.
		

Crossrefs

Programs

  • Mathematica
    upto[n_] := Block[{s = ToString /@ Range[n]}, Do[s = StringReplace[s, ToString[p] -> ""], {p, Prime@ Range@ PrimePi@ n}]; ToExpression@ DeleteCases[s, ""]]; upto[115] (* Giovanni Resta, Sep 01 2018 *)

A330356 Starting from n: as long as the decimal representation contains a prime number, replace the largest and leftmost such substring with the index of the corresponding prime number; a(n) corresponds to the final value.

Original entry on oeis.org

0, 1, 1, 1, 4, 1, 6, 4, 8, 9, 10, 1, 1, 6, 14, 6, 16, 4, 18, 8, 10, 1, 1, 9, 14, 9, 16, 14, 18, 10, 10, 1, 1, 9, 14, 9, 16, 1, 18, 10, 40, 6, 6, 14, 44, 14, 46, 6, 48, 49, 10, 1, 1, 16, 14, 9, 16, 14, 18, 4, 60, 18, 18, 18, 64, 18, 66, 8, 68, 69, 40, 10, 6, 1
Offset: 0

Views

Author

Rémy Sigrist, Dec 11 2019

Keywords

Comments

This sequence is a variant of A329428.

Examples

			For n = 8601:
- let pi = A000720,
- 8601 gives 8 followed by pi(601) = 8110,
- 8110 gives pi(811) followed by 0 = 1410,
- 1410 gives 1 followed by pi(41) followed by 0 = 1130,
- 1130 gives pi(113) followed by 0 = 300,
- 300 gives pi(3) followed by 00 = 200,
- 200 gives pi(2) followed by 00 = 100,
- no prime number appears in 100,
- hence a(8601) = 100.
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(n) <= n with equality iff n belongs to A062115.
a(prime(k)) = a(k) for any k > 0 where prime(k) denotes the k-th prime number.
a(A007097(k)) = 1 for any k >= 0.

A359982 Numbers whose digits are distinct nonprimes and are not a permutation of a smaller such number.

Original entry on oeis.org

0, 1, 4, 6, 8, 9, 10, 14, 16, 18, 19, 40, 46, 48, 49, 60, 68, 69, 80, 89, 90, 104, 106, 108, 109, 146, 148, 149, 168, 169, 189, 406, 408, 409, 468, 469, 489, 608, 609, 689, 809, 1046, 1048, 1049, 1068, 1069, 1089, 1468, 1469, 1489, 1689, 4068, 4069, 4089, 4689, 6089, 10468, 10469, 10489, 10689, 14689, 40689, 104689
Offset: 1

Views

Author

Glen Gilchrist, Jan 20 2023

Keywords

Comments

The sequence consists of numbers constructed from the combination of the six nonprime digits 0,1,4,6,8,9 without duplication of the digits. Hence there are 2^6 - 1 = 63 terms.

Examples

			10 is in the sequence as both 1 and 0 are nonprime, all digits are distinct, and no permutation of those digits yields a smaller number (with no leading 0's).
14 is in the sequence as both 1 and 4 are nonprime, all digits are distinct, and no permutation of those digits yields a smaller number.
41 is not in the sequence as 14 is a permutation of its digits and is a smaller number.
189 is in the sequence, so its permutations 198, 819, 891, 918 and 981, all of which are larger, are not.
104689 is in the sequence as all digits are nonprime and distinct, and no permutation of those digits yields a smaller number (with no leading 0's).
		

Crossrefs

Cf. A062115 (no prime substring), A124673 (distinct prime digits).

Programs

  • Maple
    sort(map(x-> parse(cat(`if`(nops(x)>1 and x[1]=0,
    [x[2], x[1], x[3..-1][]], x)[])), [seq(combinat[choose]
    ([0, 1, 4, 6, 8, 9], i)[], i=1..6)]))[];  # Alois P. Heinz, Jan 27 2023
  • Python
    import itertools
    nums, combinations, flat_list = [0,1,4,6,8,9],[],[]
    for r in range(len(nums)+1):
        for combination in itertools.combinations(nums, r):
          combinations.append(list(combination))
    for var in range(len(combinations)):
        subitems=""
        if (len(combinations[var]) > 1 and combinations[var][0] == 0) :
          combinations[var][0], combinations[var][1] = combinations[var][1], combinations[var][0]
        for sub in combinations[var]:
            subitems += str(sub)
            flat_list.append(int(subitems))
    print(sorted(set(flat_list)))

A366826 Composite numbers whose proper substrings (of their decimal expansions) are all primes.

Original entry on oeis.org

4, 6, 8, 9, 22, 25, 27, 32, 33, 35, 52, 55, 57, 72, 75, 77, 237, 537, 737
Offset: 1

Views

Author

Kalle Siukola, Oct 25 2023

Keywords

Comments

There are no terms greater than 999 because the only three-digit prime whose substrings are all primes is 373 (see A085823) and prepending or appending any prime digit to it would create a different three-digit substring.

Examples

			237 is included because it is composite and 2, 3, 7, 23 and 37 are all primes.
4 is included because it is composite and has no proper substrings.
		

Crossrefs

Subsequence of A002808.
Cf. A000040.

Programs

  • Python
    from itertools import combinations
    from sympy import isprime
    for n in range(2, 1000):
        if not isprime(n):
            properSubstrings = set(
                int(str(n)[start:end]) for (start, end)
                in combinations(range(len(str(n)) + 1), 2)
            ) - set((n,))
            if all(isprime(s) for s in properSubstrings):
                print(n, end=', ')
Showing 1-10 of 10 results.