cp's OEIS Frontend

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.

Showing 1-3 of 3 results.

A254524 n is the a(n)-th positive integer having its digitsum.

Original entry on oeis.org

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
Offset: 1

Views

Author

David A. Corneth, Jan 31 2015

Keywords

Comments

a(A051885(n)) = 1. - Reinhard Zumkeller, Oct 09 2015
Ordinal transform of A007953. - Antti Karttunen, May 20 2017

Examples

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

Crossrefs

Cf. A286478 (analogous sequence for factorial base).

Programs

  • 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
  • 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 *)
    With[{nn=400},#[[3]]&/@Sort[Flatten[Table[Flatten[#,1]&/@MapIndexed[ List,Select[ Table[{n,Total[IntegerDigits[n]]},{n,nn}],#[[2]]==k&]],{k,nn}],1]]](* Harvey P. Dale, Mar 29 2020 *)
  • 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}
    

A263017 n is the a(n)-th positive integer having its binary weight.

Original entry on oeis.org

1, 2, 1, 3, 2, 3, 1, 4, 4, 5, 2, 6, 3, 4, 1, 5, 7, 8, 5, 9, 6, 7, 2, 10, 8, 9, 3, 10, 4, 5, 1, 6, 11, 12, 11, 13, 12, 13, 6, 14, 14, 15, 7, 16, 8, 9, 2, 15, 17, 18, 10, 19, 11, 12, 3, 20, 13, 14, 4, 15, 5, 6, 1, 7, 16, 17, 21, 18, 22, 23, 16, 19, 24, 25, 17
Offset: 1

Views

Author

Paul Tek, Oct 07 2015

Keywords

Comments

Binary weight is given by A000120.
a(2^k) = k+1 for any k>=0.
a(2^k-1) = 1 for any k>0.
a(A057168(k)) = a(k)+1 for any k>0.
a(A036563(k+1)) = k for any k>0.
Ordinal transform of A000120. - Alois P. Heinz, Dec 23 2018

Examples

			The numbers with binary weight 3 are: 7, 11, 13, 14, 19, ...
Hence: a(7)=1, a(11)=2, a(13)=3, a(14)=4, a(19)=5, ...
And more generally: a(A014311(k))=k for any k>0.
		

Crossrefs

Programs

  • Haskell
    import Data.IntMap (empty, findWithDefault, insert)
    a263017 n = a263017_list !! (n-1)
    a263017_list = f 1 empty where
       f x m = y : f (x + 1) (insert h (y + 1) m) where
               y = findWithDefault 1 h m
               h = a000120 x
    -- Reinhard Zumkeller, Oct 09 2015
    
  • Maple
    a:= proc() option remember; local a, b, t; b, a:=
          proc() 0 end, proc(n) option remember; a(n-1);
            t:= add(i, i=convert(n, base, 2)); b(t):= b(t)+1
          end; a(0):=0; a
        end():
    seq(a(n), n=1..120);  # Alois P. Heinz, Dec 23 2018
  • Perl
    # See Links section.
    
  • Python
    from math import comb
    def A263017(n):
        c, k = 1, 0
        for i,j in enumerate(bin(n)[-1:1:-1]):
            if j == '1':
                k += 1
                c += comb(i,k)
        return c # Chai Wah Wu, Mar 01 2023

Formula

a(n) = 1 + A068076(n). - Antti Karttunen, May 22 2017

A263110 n is the a(n)-th positive integer having its digitsum in base-16 representation.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 3, 2, 1, 6, 6, 6, 6, 6, 6, 6
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 09 2015

Keywords

Comments

Ordinal transform of A053836. - Alois P. Heinz, Dec 23 2018

Crossrefs

Programs

  • Haskell
    import Data.IntMap (empty, findWithDefault, insert)
    a263110 n = a263110_list !! (n-1)
    a263110_list = f 1 empty where
       f x m = y : f (x + 1) (insert q (y + 1) m) where
               y = findWithDefault 1 q m; q = a053836 x
Showing 1-3 of 3 results.