login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A052218 Numbers whose sum of digits is 4. 36

%I #31 May 16 2022 02:35:58

%S 4,13,22,31,40,103,112,121,130,202,211,220,301,310,400,1003,1012,1021,

%T 1030,1102,1111,1120,1201,1210,1300,2002,2011,2020,2101,2110,2200,

%U 3001,3010,3100,4000,10003,10012,10021,10030,10102,10111,10120,10201,10210,10300

%N Numbers whose sum of digits is 4.

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

%H Michael S. Branicky, <a href="/A052218/b052218.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1001 from Vincenzo Librandi and T. D. Noe, terms 1..201 from Vincenzo Librandi)

%t Select[Range[10^5], Total[IntegerDigits[#]] == 4 &] (* _Vincenzo Librandi_, Mar 07 2013 *)

%t Union[Flatten[Table[FromDigits /@ Permutations[PadRight[s, 11]], {s, IntegerPartitions[4]}]]] (* _T. D. Noe_, Mar 08 2013 *)

%o (Magma) [n: n in [1..10300] | &+Intseq(n) eq 4 ]; // _Vincenzo Librandi_, Mar 07 2013

%o (Haskell)

%o a052218 n = a052218_list !! (n-1)

%o a052218_list = filter ((== 4) . a007953) [0..]

%o -- _Reinhard Zumkeller_, Jul 17 2014

%o (PARI) isok(n) = sumdigits(n) == 4; \\ _Michel Marcus_, Dec 28 2015

%o (Python)

%o from itertools import count, islice

%o 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))

%o print(list(islice(agen(), 45))) # _Michael S. Branicky_, May 15 2022

%Y Cf. A007953.

%Y 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).

%Y Cf. A242614, A242627.

%K nonn,base,easy

%O 1,1

%A _Henry Bottomley_, Feb 01 2000

%E Offset changed from _Bruno Berselli_, Mar 07 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 09:04 EDT 2024. Contains 371240 sequences. (Running on oeis4.)