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.
%I A052224 #61 Mar 16 2022 16:39:23 %S A052224 19,28,37,46,55,64,73,82,91,109,118,127,136,145,154,163,172,181,190, %T A052224 208,217,226,235,244,253,262,271,280,307,316,325,334,343,352,361,370, %U A052224 406,415,424,433,442,451,460,505,514,523,532,541,550,604,613,622,631,640 %N A052224 Numbers whose sum of digits is 10. %C A052224 Proper subsequence of A017173. - _Rick L. Shepherd_, Jan 12 2009 %C A052224 Subsequence of A227793. - _Michel Marcus_, Sep 23 2013 %C A052224 A007953(a(n)) = 10; number of repdigits = #{55,22222,1^10} = A242627(10) = 3. - _Reinhard Zumkeller_, Jul 17 2014 %C A052224 a(n) = A094677(n) for n = 1..28. - _Reinhard Zumkeller_, Nov 08 2015 %C A052224 The number of terms having <= m digits is the coefficient of x^10 in sum(i=0,9,x^i)^m = ((1-x^10)/(1-x))^m. - _David A. Corneth_, Jun 04 2016 %C A052224 In general, the set of numbers with sum of base-b digits equal to b is a subset of { (b-1)*k + 1; k = 2, 3, 4, ... }. - _M. F. Hasler_, Dec 23 2016 %H A052224 Rémy Sigrist, <a href="/A052224/b052224.txt">Table of n, a(n) for n = 1..10000</a> (first 3921 terms from T. D. Noe) %F A052224 a(n+1) = A228915(a(n)) for any n > 0. - _Rémy Sigrist_, Jul 10 2018 %p A052224 sd := proc (n) options operator, arrow: add(convert(n, base, 10)[j], j = 1 .. nops(convert(n, base, 10))) end proc: a := proc (n) if sd(n) = 10 then n else end if end proc: seq(a(n), n = 1 .. 800); # _Emeric Deutsch_, Jan 16 2009 %t A052224 Union[Flatten[Table[FromDigits /@ Permutations[PadRight[s, 7]], {s, Rest[IntegerPartitions[10]]}]]] (* _T. D. Noe_, Mar 08 2013 *) %t A052224 Select[Range[1000], Total[IntegerDigits[#]] == 10 &] (* _Vincenzo Librandi_, Mar 10 2013 *) %o A052224 (Magma) [n: n in [1..1000] | &+Intseq(n) eq 10 ]; // _Vincenzo Librandi_, Mar 10 2013 %o A052224 (Haskell) %o A052224 a052224 n = a052224_list !! (n-1) %o A052224 a052224_list = filter ((== 10) . a007953) [0..] %o A052224 -- _Reinhard Zumkeller_, Jul 17 2014 %o A052224 (PARI) isok(n) = sumdigits(n) == 10; \\ _Michel Marcus_, Dec 28 2015 %o A052224 (PARI) \\ This algorithm needs a modified binomial. %o A052224 C(n, k)=if(n>=k, binomial(n, k), 0) %o A052224 \\ ways to roll s-q with q dice having sides 0 through n - 1. %o A052224 b(s, q, n)=if(s<=q*(n-1), s+=q; sum(i=0, q-1, (-1)^i*C(q, i)*C(s-1-n*i, q-1)), 0) %o A052224 \\ main algorithm; this program applies to all sequences of the form "Numbers whose sum of digits is m." %o A052224 a(n,{m=10}) = {my(q); q = 2; while(b(m, q, 10) < n, q++); q--; s = m; os = m; r=0; while(q, if(b(s, q, 10) < n, n-=b(s, q, 10); s--, r+=(os-s)*10^(q); os = s; q--)); r+= s; r} %o A052224 \\ _David A. Corneth_, Jun 05 2016 %o A052224 (Python) %o A052224 from sympy.utilities.iterables import multiset_permutations %o A052224 def auptodigs(maxdigits, b=10, sod=10): # works for any base, sum-of-digits %o A052224 alst = [sod] if 0 <= sod < b else [] %o A052224 nzdigs = [i for i in range(1, b) if i <= sod] %o A052224 nzmultiset = [] %o A052224 for d in range(1, b): %o A052224 nzmultiset += [d]*(sod//d) %o A052224 for d in range(2, maxdigits + 1): %o A052224 fullmultiset = [0]*(d-1-(sod-1)//(b-1)) + nzmultiset %o A052224 for firstdig in nzdigs: %o A052224 target_sum, restmultiset = sod - int(firstdig), fullmultiset[:] %o A052224 restmultiset.remove(firstdig) %o A052224 for p in multiset_permutations(restmultiset, d-1): %o A052224 if sum(p) == target_sum: %o A052224 alst.append(int("".join(map(str, [firstdig]+p)), b)) %o A052224 if p[0] == target_sum: %o A052224 break %o A052224 return alst %o A052224 print(auptodigs(4)) # _Michael S. Branicky_, Sep 14 2021 %o A052224 (Python) %o A052224 def A052224(N = 19): %o A052224 """Return a generator of the sequence of all integers >= N with the same %o A052224 digit sum as N.""" %o A052224 while True: %o A052224 yield N %o A052224 N = A228915(N) # skip to next larger integer with the same digit sum %o A052224 a = A052224(); [next(a) for _ in range(50)] # _M. F. Hasler_, Mar 16 2022 %Y A052224 Cf. A007953, A017173, A228915, A254524. %Y A052224 Cf. A011557 (1), A052216 (2), A052217 (3), A052218 (4), A052219 (5), A052220 (6), A052221 (7), A052222 (8), A052223 (9), A166311 (11), A235151 (12), A143164 (13), A235225 (14), A235226 (15), A235227 (16), A166370 (17), A235228 (18), A166459 (19), A235229 (20). %Y A052224 Cf. A242614, A242627. %Y A052224 Cf. A094677. %Y A052224 Cf. A018900, A187813. %Y A052224 Sum of base-b digits equal b: A226636 (b = 3), A226969 (b = 4), A227062 (b = 5), A227080 (b = 6), A227092 (b = 7), A227095 (b = 8), A227238 (b = 9). %K A052224 nonn,base,easy %O A052224 1,1 %A A052224 _Henry Bottomley_, Feb 01 2000 %E A052224 Incorrect formula deleted by _N. J. A. Sloane_, Jan 15 2009 %E A052224 Extended by _Emeric Deutsch_, Jan 16 2009 %E A052224 Offset changed by _Bruno Berselli_, Mar 07 2013