login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A254524 n is the a(n)-th positive integer having its digitsum. 12
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 5, 5, 5, 5, 5, 5, 4, 3, 2, 1, 6, 6, 6, 6, 6, 5, 4, 3, 2, 1, 7, 7, 7, 7, 6, 5, 4, 3, 2, 1, 8, 8, 8, 7, 6, 5, 4, 3, 2, 1, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 5 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,10

COMMENTS

a(A051885(n)) = 1. - Reinhard Zumkeller, Oct 09 2015

Ordinal transform of A007953. - Antti Karttunen, May 20 2017

LINKS

David A. Corneth, Table of n, a(n) for n = 1..10000

EXAMPLE

35 is the 4th positive integer having digitsum 8 (the others before are 8, 17 and 26) so a(35) = 4.

MATHEMATICA

c[n_, k_] := If[n >= k, Binomial[n, k], 0]; b[s_, q_, n_] := (s1 = q; If[s <= q*(n - 1), s1 = s + q; Sum[(-1)^i*c[q, i]*c[s1 - 1 - n*i, q - 1], {i, 0, q - 1}], 0]); a[n_] := (r = 1; v = IntegerDigits[n]; l = v[[-1]]; For[i = Length[v] - 1, i >= 1, i--, For[j = 1, j <= v[[i]], j++, r += b[l + j, Length[v] - i, 10]]; l += v[[i]]]; r); Table[a[n], {n, 1, 110}] (* Jean-Fran├žois Alcover, Nov 14 2016, adapted from PARI *)

PROG

(PARI)

\\This algorithm needs a modified binomial.

C(n, k)=if(n>=k, binomial(n, k), 0)

\\ways to roll s-q with q dice having sides 0 through n - 1.

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)

\\main algorithm

a(n)={r = 1; v=digits(n); l=v[#v]; forstep(i = #v-1, 1, -1, for(j=1, v[i], r+=b(l+j, #v-i, 10)); l+=v[i]); r}

(Haskell)

import Data.IntMap (empty, findWithDefault, insert)

a254524 n = a254524_list !! (n-1)

a254524_list = f 1 empty where

   f x m = y : f (x + 1) (insert q (y + 1) m) where

           y = findWithDefault 1 q m; q = a007953 x

-- Reinhard Zumkeller, Oct 09 2015

CROSSREFS

Cf. A007953, A051885, A069877, A143164, A263017, A263109, A263110.

Cf. A286478 (analogous sequence for factorial base).

Sequence in context: A160093 A259143 A035931 * A140438 A132211 A067441

Adjacent sequences:  A254521 A254522 A254523 * A254525 A254526 A254527

KEYWORD

nonn,base,look,nice

AUTHOR

David A. Corneth, Jan 31 2015

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 21 17:43 EST 2019. Contains 319350 sequences. (Running on oeis4.)