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

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

A047842 Describe n (count digits in order of increasing value, ignoring missing digits).

Original entry on oeis.org

10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1011, 21, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1012, 1112, 22, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1013, 1113, 1213, 23, 1314, 1315, 1316, 1317, 1318, 1319, 1014, 1114, 1214, 1314, 24, 1415, 1416
Offset: 0

Views

Author

Keywords

Comments

Digit count of n. The digit count numerically summarizes the frequency of digits 0 through 9 in that order when they occur in a number. - Lekraj Beedassy, Jan 11 2007
Numbers which are digital permutations of one another have the same digit count. Compare with first entries of "Look And Say" or LS sequence A045918. As in the latter, a(n) has first odd-numbered-digit entry occurring at n=1111111111 with digit count 101, but a(n) has first ambiguous term 1011. For digit count invariants, i.e., n such that a(n)=n, see A047841. - Lekraj Beedassy, Jan 11 2007

Examples

			a(31) = 1113 because (one 1, one 3) make up 31.
101 contains one 0 and two 1's, so a(101) = 1021.
a(131) = 2113.
For n = 20231231, the digits of the date 2023-12-31, last day of 2023, a(n) = 10213223 is a fixed point: a(a(n)) = a(n) (cf. A235775). Since a(n) is invariant under permutation of the digits of n (leading zeros avoided), this is independent of the chosen notation, yyyy-mm-dd or mm/dd/yyyy or dd.mm.yyyy. - _M. F. Hasler_, Jan 11 2024
		

Crossrefs

Cf. A235775.
Cf. A244112 (the same but in order of decreasing value of digits), A010785.
Cf. A005150 (Look and Say: describe the number digit-wise instead of overall count).
Cf. A328447 (least m having the same digits as n).

Programs

  • Haskell
    import Data.List (sort, group); import Data.Function (on)
    a047842 :: Integer -> Integer
    a047842 n = read $ concat $
       zipWith ((++) `on` show) (map length xs) (map head xs)
       where xs = group $ sort $ map (read . return) $ show n
    -- Reinhard Zumkeller, Jan 15 2014
    
  • Mathematica
    dc[n_] :=FromDigits@Flatten@Select[Table[{DigitCount[n, 10, k], k}, {k, 0, 9}], #[[1]] > 0 &];Table[dc[n], {n, 0, 46}] (* Ray Chandler, Jan 09 2009 *)
    Array[FromDigits@ Flatten@ Map[Reverse, Tally@ Sort@ IntegerDigits@ #] &, 46] (* Michael De Vlieger, Jul 15 2020 *)
  • PARI
    A047842(n)={if(n, local(c=1, S="", d=vecsort(digits(n)), a(i)=Str(S, c, d[i])); for(i=2, #d, if(d[i]==d[i-1], c++, S=a(i-1); c=1)); eval(a(#d)), 10)} \\ M. F. Hasler, Feb 25 2018; edited Jan 10 2024
  • Python
    def A047842(n):
        s, x = '', str(n)
        for i in range(10):
            y = str(i)
            c = str(x.count(y))
            if c != '0':
                s += c+y
        return int(s) # Chai Wah Wu, Jan 03 2015
    

Formula

a(a(n)) = A235775(n). [By definition of A235775. - M. F. Hasler, Jan 11 2024]
a(A010785(n)) = A244112(A010785(n)). - Reinhard Zumkeller, Nov 11 2014
a(n) = a(A328447(n)) = a(m) for all n and all m having the same digits as n, with multiplicity. - M. F. Hasler, Jan 11 2024

Extensions

Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar

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

A326307 a(n) is the index of n in the ordered list of the numbers with the same digits as n.

Original entry on oeis.org

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

Views

Author

David A. Corneth, Oct 17 2019

Keywords

Comments

Ordinal transform of A328447.

Examples

			a(321) = 6 as 321 is the sixth number made of the digits [1, 2, 3]. The five smaller numbers having these digits are 123, 132, 213, 231, 312.
		

Crossrefs

Programs

  • PARI
    see Corneth link
    
  • PARI
    { o = vector(100); for (n=0, 87, print1 (o[1+fromdigits(vecsort(digits(n,base=10),,4),base)]++ ", ")) } \\ Rémy Sigrist, Oct 17 2019
    
  • PARI
    A326307(n,D=Vecsmall(digits(n)),c=1)={forperm(vecsort(D),d, d==D&&break; d[1]&&c++);c} \\ M. F. Hasler, May 19 2021
    
  • Python
    from collections import Counter
    from itertools import count, islice
    def agen(): # generator of terms
        digmultisetcount = Counter()
        for n in count(0):
            key = "".join(sorted(str(n)))
            digmultisetcount[key] += 1
            yield digmultisetcount[key]
    print(list(islice(agen(), 88))) # Michael S. Branicky, Jan 30 2025

Formula

a(A179239(n)) = 1.
a(10+n) = A007953(9*n)/9 (A007953 = sum of digits) for 0 < n < 91, but a(101) = 1 while A007953(9*91)/9 = 2. - M. F. Hasler, May 19 2021

Extensions

Edited by N. J. A. Sloane, Oct 24 2019

A235775 a(n) = A047842(A047842(n)), say what you see, once repeated.

Original entry on oeis.org

1011, 21, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1031, 1112, 3112, 3113, 3114, 3115, 3116, 3117, 3118, 3119, 102112, 3112, 22, 211213, 211214, 211215, 211216, 211217, 211218, 211219, 102113, 3113, 211213, 1213, 211314, 211315, 211316, 211317, 211318
Offset: 0

Views

Author

Reinhard Zumkeller, Jan 15 2014

Keywords

Comments

a(n) does not depend on the order of digits of n, a property inherited from A047842. - M. F. Hasler, Jan 11 2024

Examples

			a(10) = A047842(1011) = 1031;
a(11) = A047842(21) = 1112;
a(12) = A047842(1112) = 3112;
a(100) = A047842(2011) = 102112;
a(101) = A047842(1021) = 102112;
a(102) = A047842(101112) = 104112.
For n = 20231231, digits of the date 2023-12-31, a(n) = 10213223 = A047842(n) because this is a fixed point of A047842. Since the order of the digits of n does not matter and there are no leading zeros, this holds also for the numbers resulting from notation dd.mm.yyyy or mm/dd/yyyy. - _M. F. Hasler_, Jan 11 2024
		

Crossrefs

Programs

  • Haskell
    a235775 = a047842 . a047842
    
  • PARI
    A235775(n) = A047842(A047842(n)) \\ M. F. Hasler, Jan 11 2024
  • Python
    def A235775(n):
        s = str(n)
        s = ''.join(str(s.count(d))+d for d in sorted(set(s)))
        return int(''.join(str(s.count(d))+d for d in sorted(set(s)))) # Chai Wah Wu, Feb 12 2023
    

Formula

From M. F. Hasler, Jan 11 2024: (Start)
a(n) = a(A328447(n)) = a(m) for all n and all m having the same digits as n, considering their respective multiplicity.
a(n) = A047842(n) =: m iff m is a fixed point of A047842. (End)

A343888 Smallest positive integer such that the decimal representations of a(n) and of a(n)+9n (both without leading zeros) are permutations of each other.

Original entry on oeis.org

12, 13, 14, 15, 16, 17, 18, 19, 109, 120, 102, 102, 124, 125, 126, 127, 128, 129, 130, 130, 123, 103, 103, 135, 136, 137, 138, 139, 140, 140, 134, 124, 104, 104, 146, 147, 148, 149, 150, 150, 145, 135, 125, 105, 105, 157, 158, 159, 160, 160, 156, 146, 136, 126, 106, 106, 168, 169, 170, 170
Offset: 1

Views

Author

Ivan Neretin, May 02 2021

Keywords

Comments

A concatenation of 10 and n provides the proof of existence and also an upper bound for a(n).
The bound is exact for n = 9, 90, 900, ...

Examples

			102 + 9*11 = 201 which is a permutation of digits of 102, and no smaller number has this feature, hence a(11)=102.
		

Crossrefs

Programs

  • PARI
    a(n) = { for (v=1, oo, if (vecsort(digits(v))==vecsort(digits(v+9*n)), return (v))) } \\ Rémy Sigrist, May 03 2021

A337925 Digits of n rearranged to be the smallest number with the fewest possible prime factors, counted with multiplicity. Terms retain the same number of digits as n, i.e. leading digits may not be zero.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 13, 41, 15, 61, 17, 18, 19, 20, 21, 22, 23, 42, 25, 26, 27, 82, 29, 30, 13, 23, 33, 43, 53, 63, 37, 83, 39, 40, 41, 42, 43, 44, 45, 46, 47, 84, 49, 50, 15, 25, 53, 45, 55, 65, 57, 58, 59, 60, 61, 26, 63, 46, 65, 66, 67, 86, 69, 70, 17, 27, 37, 47, 57, 67, 77
Offset: 1

Views

Author

Roderick Kimball, Sep 30 2020

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{p = FromDigits /@ Select[Permutations @ IntegerDigits[n], First[#] > 0 &]}, o = PrimeOmega[p]; Min[p[[Position[o, Min[o]] // Flatten]]]]; Array[a, 100] (* Amiram Eldar, Oct 19 2020 *)
  • PARI
    a(n) = {my(d = digits(n), v = select(x->#(digits(x))==#d, vector((#d)!, i, fromdigits(vector(#d, k, d[numtoperm(#d, i-1)[k]])))), b = vecmin(vector(#v, k, bigomega(v[k])))); vecmin(select(x->(bigomega(x)==b), v));} \\ Michel Marcus, Oct 19 2020

Formula

a(a(n)) = a(n). - Rémy Sigrist, Oct 22 2020

A348287 Arrange nonzero digits of n in increasing order then append the zeros.

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, 12, 22, 23, 24, 25, 26, 27, 28, 29, 30, 13, 23, 33, 34, 35, 36, 37, 38, 39, 40, 14, 24, 34, 44, 45, 46, 47, 48, 49, 50, 15, 25, 35, 45, 55, 56, 57, 58, 59, 60, 16, 26, 36, 46, 56, 66
Offset: 0

Views

Author

Simon Strandgaard, Oct 10 2021

Keywords

Comments

Shares 101 initial terms with A328447. First difference is A328447(101)=101 vs A348287(101)=110.

Examples

			a(1010) = 1100,
a(1234567890) = 1234567890,
a(9876543210) = 1234567890.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := 10^DigitCount[n, 10, 0] * FromDigits[Sort[IntegerDigits[n]]]; Array[a, 100, 0] (* Amiram Eldar, Oct 10 2021 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n), x->if(x,x,10)));
    
  • Python
    def a(n): s = str(n); return int("".join(sorted(s)))*10**s.count('0')
    print([a(n) for n in range(68)]) # Michael S. Branicky, Oct 10 2021
  • Ruby
    p Array.new(40) { |n|
      n.to_s.gsub('0','a').split(//).sort.join.gsub('a','0').to_i
    }
    

A376550 Smallest primes that generate a record number of deranged primes (see Comments).

Original entry on oeis.org

2, 13, 197, 1097, 10259, 10273, 10369, 10723, 10739, 10937, 13729, 31729, 38791, 101267, 101273, 102139, 102359, 102367, 102397, 105379, 107839, 108793, 109387, 109537, 109873, 130579, 150379, 709831, 1002739, 1002973, 1003879, 1005937, 1008379, 1012369, 1012379
Offset: 1

Views

Author

Ivan N. Ianakiev, Nov 27 2024

Keywords

Comments

A derangement is a permutation of the elements of a set in which no element appears in its original position. In the present case, elements and set stand for digits and number.
When counting deranged primes, leading zeros are allowed.
The respective number of deranged primes is: 0,1,2,5,6,8,9,10,12,14,15,17,18,...
From David A. Corneth, Nov 28 2024: (Start)
a(105) > 185000000. Likely a(105)..a(110) are 324908761, 364150279, 403157269, 504921367, 539021467, 724908361 and a(111) onwards > 10^9. If there is any term between 10^8 and 10^9 that is not listed in the b-file and not listed in the candidates I gave then any such term t meets A328447(t) > 103567778 and t > 18500000. (End)
The likely terms a(105)..a(110) above are indeed terms. - Michael S. Branicky, Nov 30 2024

Examples

			The smallest prime generating one deranged prime is 13, where the deranged prime is 31. The smallest prime generating two deranged primes is 197, where the deranged primes are 719 and 971. So, 13 and 197 are terms. Although 10753 is the smallest prime that generates 7 deranged primes it is not a term, since the smaller prime 10273 generates a record of 8 deranged primes.
		

Crossrefs

Programs

  • Mathematica
    (* How to find a(4) among the 4-digit candidates, where z=9 is the number of derangements of a 4-element set *)
    Derangements[list_]:=Module[{n=Length[list],perms,isDerangement},
    perms=Permutations[list];isDerangement[perm_]:=And@@Table[perm[[i]]!=list[[i]],{i,n}]; Select[perms,isDerangement]];
    numberOfPrimeDerangements[n_]:=Length[Select[FromDigits/@Derangements[IntegerDigits[n]],PrimeQ]];
    listOf4digitCandidates=Table[{z,Select[Prime/@Range[169,1229],numberOfPrimeDerangements[#]==z&,1]},{z,3,9}]
  • PARI
    \\ See Corneth link
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    from sympy.utilities.iterables import multiset_derangements as md
    def f(n): return len(set(tuple(d) for d in md(list(str(n))) if isprime(int("".join(d)))))
    def agen(): # generator of terms
        record, p = -1, 2
        while True:
            v = f(p)
            if v > record:
                yield p
                record = v
            p = nextprime(p)
    print(list(islice(agen(), 26))) # Michael S. Branicky, Nov 27 2024
    

Extensions

a(14) and beyond from Michael S. Branicky, Nov 27 2024
2 prepended by David A. Corneth, Nov 27 2024
Showing 1-9 of 9 results.