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
KEYWORD
nonn,base,easy
AUTHOR
Henry Bottomley, Feb 01 2000
EXTENSIONS
Offset changed from Bruno Berselli, Mar 07 2013
STATUS
approved