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.

A052218 Numbers whose sum of digits is 4.

Original entry on oeis.org

4, 13, 22, 31, 40, 103, 112, 121, 130, 202, 211, 220, 301, 310, 400, 1003, 1012, 1021, 1030, 1102, 1111, 1120, 1201, 1210, 1300, 2002, 2011, 2020, 2101, 2110, 2200, 3001, 3010, 3100, 4000, 10003, 10012, 10021, 10030, 10102, 10111, 10120, 10201, 10210, 10300
Offset: 1

Views

Author

Henry Bottomley, Feb 01 2000

Keywords

Comments

A007953(a(n)) = 4; number of repdigits = #{4,22,1111} = A242627(4) = 3. - Reinhard Zumkeller, Jul 17 2014

Crossrefs

Cf. A007953.
Cf. A011557 (1), A052216 (2), A052217 (3), A052219 (5), A052220 (6), A052221 (7), A052222 (8), A052223 (9), A052224 (10), A166311 (11), A235151 (12), A143164 (13), A235225(14), A235226 (15), A235227 (16), A166370 (17), A235228 (18), A166459 (19), A235229 (20).

Programs

  • Haskell
    a052218 n = a052218_list !! (n-1)
    a052218_list = filter ((== 4) . a007953) [0..]
    -- Reinhard Zumkeller, Jul 17 2014
    
  • Magma
    [n: n in [1..10300] | &+Intseq(n) eq 4 ]; // Vincenzo Librandi, Mar 07 2013
    
  • Mathematica
    Select[Range[10^5], Total[IntegerDigits[#]] == 4 &] (* Vincenzo Librandi, Mar 07 2013 *)
    Union[Flatten[Table[FromDigits /@ Permutations[PadRight[s, 11]], {s, IntegerPartitions[4]}]]] (* T. D. Noe, Mar 08 2013 *)
  • PARI
    isok(n) = sumdigits(n) == 4; \\ Michel Marcus, Dec 28 2015
    
  • Python
    from itertools import count, islice
    def agen(): yield from (10**i + 10**j + 10**k + 10**m for i in count(0) for j in range(i+1) for k in range(j+1) for m in range(k+1))
    print(list(islice(agen(), 45))) # Michael S. Branicky, May 15 2022

Extensions

Offset changed from Bruno Berselli, Mar 07 2013