[go: up one dir, main page]

login
A052218
Numbers whose sum of digits is 4.
37
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,1
COMMENTS
A007953(a(n)) = 4; number of repdigits = #{4,22,1111} = A242627(4) = 3. - Reinhard Zumkeller, Jul 17 2014
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1001 from Vincenzo Librandi and T. D. Noe, terms 1..201 from Vincenzo Librandi)
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 *)
PROG
(Magma) [n: n in [1..10300] | &+Intseq(n) eq 4 ]; // Vincenzo Librandi, Mar 07 2013
(Haskell)
a052218 n = a052218_list !! (n-1)
a052218_list = filter ((== 4) . a007953) [0..]
-- Reinhard Zumkeller, Jul 17 2014
(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
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).
Sequence in context: A043469 A067396 A017209 * A341005 A183148 A202089
KEYWORD
nonn,base,easy
AUTHOR
Henry Bottomley, Feb 01 2000
EXTENSIONS
Offset changed from Bruno Berselli, Mar 07 2013
STATUS
approved