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

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

A056815 Primes with prime "look and say" descriptions.

Original entry on oeis.org

3, 7, 17, 23, 113, 127, 137, 193, 199, 223, 233, 271, 311, 313, 331, 359, 367, 373, 431, 433, 439, 463, 479, 499, 503, 523, 587, 607, 641, 677, 691, 733, 757, 773, 797, 809, 821, 823, 829, 853, 919, 997, 1009, 1069, 1123, 1129, 1171, 1181, 1187, 1223, 1277
Offset: 1

Views

Author

Joseph L. Pe, Jan 30 2003

Keywords

Comments

The "look and say" descriptions of some of these primes are themselves also terms of this sequence (for example, the one for 373). - Alonso del Arte, Mar 01 2012

Examples

			193 is prime and its "look and say" description A045918(193) = 111913, is also prime, so 193 belongs to the sequence.
		

References

  • David Wells, Prime Numbers: The Most Mysterious Figures in Math. Hoboken, New Jersey: John Wiley & Sons (2005): 41.

Crossrefs

Programs

  • Haskell
    a056815 n = a056815_list !! (n-1)
    a056815_list = filter ((== 1) . a010051' . a045918) a000040_list
    -- Reinhard Zumkeller, Apr 14 2014
    
  • Mathematica
    LookAndSayA[ n_] := FromDigits@Flatten@((Through[ {Length, First}[ # ] ] &) /@ Split@IntegerDigits@n); Select[Prime@Range[210], PrimeQ@LookAndSayA@# &] (* Ray Chandler, Jan 12 2007 *)
    (* Emmanuel Vantieghem, Jan 26 2012, reports that the above Mma program is incorrect, because the LookAndSayA function can give wrong answers. Here is a better function (b and c to be substituted by suitable numbers): *)
    LookAndSayA[n_] := FromDigits@Flatten@(IntegerDigits/@Flatten@
    ((Through[{Length, First}[#]]&)/@Split@IntegerDigits@n)); W=Select[Prime@Range[b, c], PrimeQ@LookAndSayA@#&]
    (* Robert G. Wilson v then commented (Jan 27 2012) that the following version is cleaner: *)
    LookAndSayA[n_] := FromDigits@ Flatten@ IntegerDigits@ Flatten[
    Through[{Length, First}[#]] & /@ Split@ IntegerDigits@ n]
  • PARI
    forprime(p=1,999, isprime(A045918(p)) & print1(p","))  \\ M. F. Hasler, Jan 27 2012
    
  • Python
    from sympy import isprime, sieve
    from itertools import groupby, islice
    def LS(n): return int(''.join(str(len(list(g)))+k for k, g in groupby(str(n))))
    def agen(): yield from (p for p in sieve if isprime(LS(p)))
    print(list(islice(agen(), 51))) # Michael S. Branicky, Feb 03 2023

Formula

A010051(a(n)) * A010051(A045918(a(n))) = 1. - Reinhard Zumkeller, Apr 14 2014

Extensions

Discussion of Mma program added Feb 02 2012 by N. J. A. Sloane

A127354 Digit count of prime(n). The digit count numerically summarizes the frequency of digits 0 through 9 in that order when they occur in a number.

Original entry on oeis.org

12, 13, 15, 17, 21, 1113, 1117, 1119, 1213, 1219, 1113, 1317, 1114, 1314, 1417, 1315, 1519, 1116, 1617, 1117, 1317, 1719, 1318, 1819, 1719, 1021, 101113, 101117, 101119, 2113, 111217, 2113, 111317, 111319, 111419, 2115, 111517, 111316, 111617, 111317
Offset: 1

Views

Author

Lekraj Beedassy, Jan 11 2007

Keywords

Crossrefs

Programs

  • Haskell
    a127354 = a047842 . a000040  -- Reinhard Zumkeller, Apr 14 2014
  • Mathematica
    dc[n_] :=FromDigits@Flatten@Select[Table[{DigitCount[n, 10, k], k}, {k, 0, 9}], #[[1]] > 0 &];Table[dc[Prime[n]], {n, 40}] (* Ray Chandler, Jan 16 2007 *)

Formula

a(n) = A047842(A000040(n)).
Showing 1-3 of 3 results.