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 13 results. Next

A134597 a(n) gives the maximal value of A075053(m) for any n-digit number m.

Original entry on oeis.org

1, 4, 11, 31, 106, 402, 1953
Offset: 1

Views

Author

N. J. A. Sloane, Jan 25 2008

Keywords

Comments

In A075053(m), the primes obtained as permutations of digits of m are counted several times if they can be obtained in several different ways. See sequence A076730 which uses A039993 instead, i.e., counting only different primes. - M. F. Hasler, Mar 11 2014
The original data given for n = 3, 4, 5 was erroneously A007526(n). - Up to n = 6, a(n) = A076730(n), but the two will differ not later than for n = 10, where A134596(10) = 1123456789 gives a(10) >= 398100 = A075053(1123456789) > A039993(1123456789) = 362451 = A076730(10). The difference arises because each prime containing a single '1' will be counted twice by A075053, but only once by A039993. - M. F. Hasler, Oct 14 2019

Examples

			From _M. F. Hasler_, Oct 14 2019: (Start)
a(2) = 4 = A075053(37), because from 37 one can obtain the primes {3, 7, 37, 73}, and there is obviously no 2-digit number which could give more primes.
a(3) = 11 = A075053(137), because from 137 one can obtain the primes {3, 7, 13, 17, 31, 37, 71, 73, 137, 173, 317}, and no 3-digit number yields more.
a(4) = 31 = A075053(1379), because from 1379 one can obtain the 31 primes {3, 7, 13, 17, 19, 31, 37, 71, 73, 79, 97, 137, 139, 173, 179, 193, 197, 317, 379, 397, 719, 739, 937, 971, 1973, 3719, 3917, 7193, 9137, 9173, 9371}, and no 4-digit number yields more.
a(5) = 106 = A075053(13679). a(6) = 402 = A075053(123479).
a(7) = 1953 = A075053(1234679). (End)
		

Crossrefs

Cf. A239196 for record indices of A075053, A239197 for associated record values.

Programs

  • PARI
    A134597(n)={my(m=0);forvec(D=vector(n,i,[0,9]), vecsum(D)%3||next;m=max(A075053(fromdigits(D),D),m),1);m} \\ M. F. Hasler, Oct 14 2019

Formula

a(n) <= A007526(n), with equality iff n <= 2. [Keith]
a(n) = max { A075053(m); 10^(n-1) <= m < 10^n } >= A076730(n) = max { A039993(m); 10^(n-1) <= m < 10^n }. - M. F. Hasler, Mar 11 2014

Extensions

Link fixed by Charles R Greathouse IV, Aug 13 2009
Definition corrected by M. F. Hasler, Mar 11 2014
Data corrected and extended by M. F. Hasler, Oct 14 2019

A239196 A variant of primeval numbers A072857 where primes are counted with repetition as in A075053, not as in A039993.

Original entry on oeis.org

1, 2, 13, 37, 107, 113, 137, 1013, 1037, 1079, 1136, 1139, 1237, 1337, 1379, 10013, 10039, 10079, 10133, 10136, 10139, 10379, 12379, 13679, 100136, 100139, 100379, 101237, 102347, 102379, 103679
Offset: 1

Views

Author

M. F. Hasler, Mar 12 2014

Keywords

Comments

Coincides with A072857 up to a(10) = 1079, but then this sequence lists two "intermediate" records 1136, 1139, before a(13) = 1237 = A072857(11).
"With repetition" means that primes are counted several times if they are obtained from different (not distinct) digits (e.g., 13 is obtained twice from 113), but not if they are obtained as different permutations of the same digits (e.g., p=11 is *not* counted twice even though it results as identical permutation and transposition (2,1) from the digits [1,1]).
The initial a(1)=1 has been chosen for consistency with A072857, it could be argued that it should not be there or listed as a(0).
See A239197 for the record values A075053(a(n)) reached for these numbers which are the indices of the records in A075053.

Programs

  • PARI
    m=-1;for(k=1, 9e9, A075053(k)>m&&print1(k",")+m=A075053(k)) \\ Not very efficient; from 199, 1999, 19999 etc one could jump to the next larger power of 10. - M. F. Hasler, Mar 12 2014

A239197 The record values A075053 associated to the records (indices) listed in A239196.

Original entry on oeis.org

0, 1, 3, 4, 5, 9, 11, 17, 19, 21, 23, 25, 26, 29, 31, 32, 33, 44, 48, 52, 66, 89, 96, 106, 117, 164, 211, 236, 248, 311, 349
Offset: 1

Views

Author

M. F. Hasler, Mar 12 2014

Keywords

Comments

This and A239196 are the analogs (related to A075053) of A076497 and A072857 (primeval numbers), related to A039993.

Programs

  • PARI
    m=-1; for(k=1, 9e9, A075053(k)>m&&print1(m=A075053(k),",")) \\ Not very efficient; from 199, 1999, 19999 etc one can jump to the next larger power of 10. - M. F. Hasler, Mar 12 2014

Formula

a(n)=A075053(A239196(n)).

A328517 Primitive sequence underlying A075053.

Original entry on oeis.org

0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 3, 1, 1, 1, 3, 0, 1, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 2, 3, 1, 4, 2, 1, 0, 0, 1, 0, 2, 0, 0, 1, 2, 1, 2, 1, 2, 0, 0, 2, 0, 0, 1, 2, 1, 3, 0, 0, 1, 0, 0, 0, 2, 1, 4, 2, 1, 2, 5, 0, 2, 3, 3, 9, 3, 3, 3, 6, 3, 5, 2, 5, 4, 4, 2, 6, 3, 3, 8, 6, 5, 7, 11
Offset: 0

Views

Author

David A. Corneth, Oct 18 2019

Keywords

Comments

A179239 lists the least number that has its permutation of digits.

Examples

			a(34) = 4 as A075053(A179239(34)) = A075053(37) = 4. The four primes embedded in 37 according to A075053 are {3, 7, 37, 73}.
		

Crossrefs

Cf. A075053.

Formula

a(n) = A075053(A179239(n)).

A179239 Permutation classes of integers, each identified by its smallest member.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 70, 77, 78, 79, 80, 88, 89, 90, 99, 100, 101, 102, 103
Offset: 0

Views

Author

Aaron Dunigan AtLee, Jul 04 2010

Keywords

Comments

Let the "permutation set" of a positive integer n be the set of all integers formed by permuting the digits of n. Two integers are "permutationally congruent" if they generate the same permutation set. A "permutation class" is a set of all permutationally congruent integers. This sequence lists each permutation class, identified by its smallest member.
These are also the positive integers in order, omitting any d-digit number n if a previously listed d-digit number is a permutation of the digits of n.
Range of A328447: smallest representative of the equivalence class of all numbers having the same digits up to permutation. Equivalently: Numbers with digits in nondecreasing order, except that the smallest nonzero digit must precede the zero digits. This sequence is useful when considering functions which depend only on the digits of n, e.g., the number of primes contained in n, cf. A039993, A039999, A075053 and the records therein, A072857 (primeval numbers) and A076497, resp. A239196 and A239197, etc. - M. F. Hasler, Oct 18 2019

Examples

			The permutation set of 24 is {24, 42}, and this is the equivalence class modulo permutations of both of them, so 24 is listed, but 42 is not.
The permutation set of 30 is {3, 30}, but 3 is not in the same permutation class as 30 since 30 cannot be obtained by permuting digits of 3. Therefore 30 is listed separately from 3.
The numbers 89 and 98 are also permutationally congruent and form a permutation class, so only the smaller one is listed.
		

Crossrefs

A variant of A009994.
Cf. A047726, A035927 (Number of distinct n-digit numbers up to permutations of digits).
Cf. A004186, A328447: largest & smallest representative of the class of n.

Programs

  • Mathematica
    maxTerm = 103; (*maxTerm is the greatest term you wish to see*) permutationSet[n_Integer] := FromDigits /@ Permutations[IntegerDigits[n]]; permutationCongruentQ[x_Integer, y_Integer] := Sort[permutationSet[x]] == Sort[permutationSet[y]]; DeleteDuplicates[Range[maxTerm], permutationCongruentQ]
    f[n_] := Block[{a = {0}, b = {DigitCount[0]}, i, w}, Do[w = DigitCount@ i; AppendTo[b, w]; If[! MemberQ[Most@ b, w], AppendTo[a, i]], {i, n}]; Rest@ a]; f@ 103 (* or faster: *)
    Select[Range@ 103, LessEqual @@ IntegerDigits@ # || And[Take[IntegerDigits@ #, Last@ DigitCount@ # + 1] == Reverse@ Take[Sort@ IntegerDigits@ #, Last@ DigitCount@ # + 1], LessEqual @@ DeleteCases[IntegerDigits@ #, d_ /; d == 0]] &] (* Michael De Vlieger, Jul 14 2015 *)
  • PARI
    is(n) = {my(d=digits(n),i); for(i=2,#d, if(d[i]!=0, d=vecextract(d,concat([1],vector(#d-i+1,j,i-1+j))); break));d==vecsort(d)||n/10^valuation(n,10)<10}
    \\given an element n, in base b, find the next element from the sequence.
    nxt(n,{b=10}) = {my(d = digits(n)); i = #d; while(i>0&&d[i]==b-1,i--); if(i>1, if(d[i]>0, d[i]++, d[i]=d[1];);for(j=i+1,#d,d[j]=d[i]), if(i==1, d[i]++;for(j=2,#d,d[j]=0), return(10^(#d))));sum(j=1,#d,d[j]*10^(#d-j))} \\ David A. Corneth, Apr 23 2016
    
  • PARI
    select( is_A179239(n)={n==A328447(n)}, [0..200]) \\ M. F. Hasler, Oct 18 2019
    
  • Python
    from itertools import count, chain, islice
    from sympy.utilities.iterables import combinations_with_replacement
    def A179239_gen(): # generator of terms
        return chain((0,),(int(a+''.join(b)) for l in count(1) for a in '123456789' for b in combinations_with_replacement('0'+''.join(str(d) for d in range(int(a),10)),l-1)))
    A179239_list = list(islice(A179239_gen(),31)) # Chai Wah Wu, Sep 13 2022

Extensions

Prefixed with a(0) = 0 by M. F. Hasler, Oct 18 2019

A039993 Number of different primes embedded in n.

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 3, 1, 1, 1, 3, 0, 1, 1, 1, 1, 3, 1, 2, 1, 2, 1, 2, 1, 3, 3, 1, 2, 3, 1, 4, 2, 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, 3, 2, 4, 2, 2, 2, 1, 1, 3, 0, 0, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 0, 2, 0, 3, 1, 0, 0, 2, 1, 4, 2, 1
Offset: 1

Views

Author

Keywords

Comments

a(n) counts (distinct) permuted subsequences of digits of n which denote primes.

Examples

			a(17) = 3 since we can obtain 7, 17 and 71. a(22) = 1, since we can get only one prime (in contrast, A075053(22) = 2).
a(1013) = 14 because the prime subsets derived from the digital permutations of 1013 are {3, 11, 13, 31, 101, 103, 113, 131, 311, 1013, 1031, 1103, 1301, 3011}.
		

Crossrefs

Different from A075053. For records see A072857, A076497. See also A134596, A134597.
Cf. A039999.

Programs

  • Mathematica
    Needs["DiscreteMath`Combinatorica`"]; f[n_] := Block[{a = Drop[ Sort[ Subsets[ IntegerDigits[n]]], 1], b = c = {}, k = 1, l}, l = Length[a] + 1; While[k < l, b = Append[b, Permutations[ a[[k]] ]]; k++ ]; b = Union[ Flatten[b, 1]]; l = Length[b] + 1; k = 1; While[k < l, c = Append[c, FromDigits[ b[[k]] ]]; k++ ]; Count[ PrimeQ[ Union[c]], True]]; Table[ f[n], {n, 1, 105}]
    Table[Count[Union[FromDigits/@(Flatten[Permutations/@Subsets[ IntegerDigits[ n]],1])],?PrimeQ],{n,110}] (* _Harvey P. Dale, Nov 29 2017 *)
  • PARI
    A039993(n)={my(S=[],D=vecsort(digits(n))); for(i=1,2^#D-1, forperm(vecextract(D,i),p, isprime(fromdigits(Vec(p)))||next; S=setunion(S,[fromdigits(Vec(p))]))); #S} \\ To avoid duplicate scan of identical subsets of digits, one could skip the corresponding range of indices i when a binary pattern ...10... is detected. - M. F. Hasler, Mar 08 2014, simplified Oct 15 2019
    
  • Python
    from itertools import permutations
    from sympy import isprime
    def a(n):
        l=list(str(n))
        L=[]
        for i in range(len(l)):
            L+=[int("".join(x)) for x in permutations(l, i + 1)]
        return len([i for i in set(L) if isprime(i)])
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 25 2017
    
  • Python
    from sympy.utilities.iterables import multiset_permutations
    from sympy import isprime
    def A039993(n): return sum(1 for l in range(1,len(str(n))+1) for a in multiset_permutations(str(n),size=l) if a[0] !='0' and isprime(int(''.join(a)))) # Chai Wah Wu, Sep 13 2022

Extensions

Edited by Robert G. Wilson v, Nov 25 2002
Keith link repaired by Charles R Greathouse IV, Aug 13 2009

A039999 Number of permutations of digits of n which yield distinct primes.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Consider all k! permutations of digits of a k-digit number n, discard initial zeros, count distinct primes.

Examples

			a(20) = 1, since from {02, 20} we get {2,20} and only 2 is prime.
From 107 we get 4 primes: (0)17, (0)71, 107 and 701; so a(107) = 4.
		

Crossrefs

Cf. A046810.
Cf. A039993 (number of primes embedded in n), A076730 (maximum for n digits), A072857 (record indices: primeval numbers), A134596 (largest with n digits).
Cf. A075053 (as A039993 but counted with multiplicity), A134597 (maximum for n digits).

Programs

  • Haskell
    import Data.List (permutations, nub)
    a039999 n = length $ filter ((== 1) . a010051)
                       (map read (nub $ permutations $ show n) :: [Integer])
    -- Reinhard Zumkeller, Feb 07 2011
    
  • Magma
    [ #[ s: s in Seqset([ Seqint([m(p[i]):i in [1..#x] ], 10): p in Permutations(Seqset(x)) ]) | IsPrime(s) ] where m is map< x->y | [:i in [1..#x] ] > where x is [1..#y] where y is Intseq(n,10): n in [1..120] ]; // Klaus Brockhaus, Jun 15 2009
    
  • Mathematica
    Table[Count[FromDigits/@Permutations[IntegerDigits[n]],?PrimeQ], {n,110}] (* _Harvey P. Dale, Jun 26 2011 *)
  • PARI
    for(x=1, 400, print1(permprime(x), ",")) /* for definition of function permprime cf. link */ \\ Cino Hilliard, Jun 07 2009
    
  • PARI
    A039999(n,D=vecsort(digits(n)),S)={forperm(D,p, isprime(fromdigits(Vec(p))) && S++);S} \\ Giving the 2nd arg avoids computing it and increases efficiency when the digits are already known. Must be sorted because forperm() only considers "larger" permutations. - M. F. Hasler, Oct 14 2019
    
  • Python
    from sympy import isprime
    from itertools import permutations
    def a(n): return len(set(t for p in permutations(str(n)) if isprime(t:=int("".join(p)))))
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Feb 17 2024

Extensions

Contribution of Cino Hilliard edited by Klaus Brockhaus, Jun 15 2009
Edited by M. F. Hasler, Oct 14 2019

A072857 Primeval numbers: numbers that set a record for the number of distinct primes that can be obtained by permuting some subset of their digits.

Original entry on oeis.org

1, 2, 13, 37, 107, 113, 137, 1013, 1037, 1079, 1237, 1367, 1379, 10079, 10123, 10136, 10139, 10237, 10279, 10367, 10379, 12379, 13679, 100279, 100379, 101237, 102347, 102379, 103679, 123479, 1001237, 1002347, 1002379, 1003679, 1012349, 1012379, 1023457, 1023467, 1023479, 1234579, 1234679, 10012349
Offset: 1

Views

Author

Lekraj Beedassy, Jul 26 2002

Keywords

Comments

RECORDS transform of A039993. - N. J. A. Sloane, Jan 25 2008. See A239196 and A239197 for the RECORDS transform of the closely related sequence A075053. - M. F. Hasler, Mar 12 2014
"73 is the largest integer with the property that all permutations of all of its substrings are primes." - M. Keith
Smallest monotonic increasing subsequence of A076449. - Lekraj Beedassy, Sep 23 2006
From M. F. Hasler, Oct 15 2019: (Start)
All terms > 37 start with leading digit 1 and have all other digits in nondecreasing order. The terms are smallest representatives of the class of numbers having the same digits, cf. A179239 and A328447 which both contain this as a subsequence.
The frequency of primes is roughly 50% for the displayed values, but appears to decrease. Can it be proved that the asymptotic density is zero?
Can we prove that there are infinitely many even terms? (Of the form 10...01..12345678?)
Can it be proved that there is no term that is a multiple of 3? (Or the contrary? Are there infinitely many?) (End)

Examples

			1379 is in the sequence because it is the smallest number whose digital permutations form a total of 31 primes, viz. 3, 7, 13, 17, 19, 31, 37, 71, 73, 79, 97, 137, 139, 173, 179, 193, 197, 317, 379, 397, 719, 739, 937, 971, 1973, 3719, 3917, 7193, 9137, 9173, 9371.
		

References

  • J.-P. Delahaye, Merveilleux nombres premiers ("Amazing primes"), "1379's quite primeval, is it not?", pp. 318-321, Pour la Science, Paris 2000.

Crossrefs

A076449 gives a similar sequence.
Cf. A119535 (prime subsequence).

Programs

Extensions

Edited, corrected and extended by Robert G. Wilson v, Nov 12 2002
Comment corrected by N. J. A. Sloane, Jan 25 2008

A076449 Least number whose digits can be used to form exactly n different primes (not necessarily using all digits).

Original entry on oeis.org

1, 2, 25, 13, 37, 107, 127, 113, 167, 1027, 179, 137, 1036, 1127, 1013, 1137, 1235, 1136, 1123, 1037, 1139, 1079, 10124, 10126, 1349, 1279, 1237, 3479, 10699, 1367, 10179, 1379, 10127, 10079, 10138, 10123, 10234, 10235, 10247, 10339, 10267
Offset: 0

Views

Author

Lekraj Beedassy, Nov 07 2002

Keywords

Comments

Smallest m such that A039993(m) = n. - M. F. Hasler, Mar 08 2014
Mike Keith conjectures that a(n) always exists and reports that he has checked this for n <= 66. - N. J. A. Sloane, Jan 25 2008

Examples

			a(10) = 179 because 179 is the least number harboring ten primes (namely 7, 17, 19, 71, 79, 97, 179, 197, 719, 971).
		

Crossrefs

Cf. A075053, A072857 gives a similar sequence, A134596.

Programs

  • Mathematica
    (* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) f[n_] := Length[ Select[ FromDigits /@ Flatten[ Permutations /@ Subsets[ IntegerDigits[ n]], 1], PrimeQ[ # ] &]]; t = Table[0, {50}]; Do[ a = f[n]; If[a < 50 && t[[a + 1]] == 0, t[[a + 1]] = n], {n, 12500}]; t (* Robert G. Wilson v, Feb 12 2005 *)
  • PARI
    A076449(n)=for(m=1,oo,A039993(m)==n&&return(m)) \\ Not very efficient. - M. F. Hasler, Mar 08 2014
    
  • Python
    # see linked program

Formula

a(n) = min { m | A039993(m)=n } = min A039993^{-1}(n). - M. F. Hasler, Mar 08 2014

Extensions

Edited by Robert G. Wilson v, Nov 24 2002
Keith link repaired by Charles R Greathouse IV, Aug 13 2009
Definition reworded by M. F. Hasler, Mar 08 2014
a(26) corrected by Robert G. Wilson v, Mar 12 2014

A076497 Number of primes corresponding to n-th primeval number A072857(n).

Original entry on oeis.org

0, 1, 3, 4, 5, 7, 11, 14, 19, 21, 26, 29, 31, 33, 35, 41, 53, 55, 60, 64, 89, 96, 106, 122, 153, 188, 248, 311, 349, 402, 421, 547, 705, 812, 906, 1098, 1162, 1268, 1662, 1738, 1953, 2418, 2920, 3133, 3457, 4483, 4517, 4917, 5174, 5953, 6552, 6799, 8938, 10219
Offset: 1

Views

Author

Lekraj Beedassy, Nov 08 2002

Keywords

Examples

			a(3) = 3 because the primeval number A072857(3) = 13 can be used to create 3 prime numbers, namely 3, 13 and 31.
a(6) = 7 because the primeval number A072857(7) = 113 can be used to create 7 prime numbers, namely 3, 11, 13, 31, 113, 131 and 311. (The two primes 13 and 31 can be obtained in 2 ways, therefore A075053(113) = 9.)
		

Crossrefs

Programs

  • Mathematica
    Needs["DiscreteMath`Combinatorica`"]; f[n_] := Block[{a = Drop[ Sort[ Subsets[ IntegerDigits[n]]], 1], b = c = {}, k = 1, l}, l = Length[a] + 1; While[k < l, b = Append[b, Permutations[ a[[k]] ]]; k++ ]; b = Union[ Flatten[b, 1]]; l = Length[b] + 1; k = 1; While[k < l, c = Append[c, FromDigits[ b[[k]] ]]; k++ ]; Count[ PrimeQ[ Union[c]], True]]; d = -1; Do[ b = f[n]; If[b > d, Print[b]; d = b], {n, 1, 10^6}]

Formula

a(n) = A039993(A072857(n)). - M. F. Hasler, Mar 12 2014

Extensions

Edited and extended by Robert G. Wilson v, Nov 12 2002
Links fixed by Charles R Greathouse IV, Aug 13 2009
a(40)-a(54) from Giovanni Resta, Nov 06 2013
Showing 1-10 of 13 results. Next