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.

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

This page as a plain text file.
%I A263017 #37 Sep 27 2024 23:22:10
%S A263017 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,
%T A263017 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,
%U A263017 4,15,5,6,1,7,16,17,21,18,22,23,16,19,24,25,17
%N A263017 n is the a(n)-th positive integer having its binary weight.
%C A263017 Binary weight is given by A000120.
%C A263017 a(2^k) = k+1 for any k>=0.
%C A263017 a(2^k-1) = 1 for any k>0.
%C A263017 a(A057168(k)) = a(k)+1 for any k>0.
%C A263017 a(A036563(k+1)) = k for any k>0.
%C A263017 Ordinal transform of A000120. - _Alois P. Heinz_, Dec 23 2018
%H A263017 Paul Tek, <a href="/A263017/b263017.txt">Table of n, a(n) for n = 1..10000</a>
%H A263017 Paul Tek, <a href="/A263017/a263017.pl.txt">PERL program for this sequence</a>
%F A263017 a(n) = 1 + A068076(n). - _Antti Karttunen_, May 22 2017
%e A263017 The numbers with binary weight 3 are: 7, 11, 13, 14, 19, ...
%e A263017 Hence: a(7)=1, a(11)=2, a(13)=3, a(14)=4, a(19)=5, ...
%e A263017 And more generally: a(A014311(k))=k for any k>0.
%p A263017 a:= proc() option remember; local a, b, t; b, a:=
%p A263017       proc() 0 end, proc(n) option remember; a(n-1);
%p A263017         t:= add(i, i=convert(n, base, 2)); b(t):= b(t)+1
%p A263017       end; a(0):=0; a
%p A263017     end():
%p A263017 seq(a(n), n=1..120);  # _Alois P. Heinz_, Dec 23 2018
%o A263017 (Perl) # See Links section.
%o A263017 (Haskell)
%o A263017 import Data.IntMap (empty, findWithDefault, insert)
%o A263017 a263017 n = a263017_list !! (n-1)
%o A263017 a263017_list = f 1 empty where
%o A263017    f x m = y : f (x + 1) (insert h (y + 1) m) where
%o A263017            y = findWithDefault 1 h m
%o A263017            h = a000120 x
%o A263017 -- _Reinhard Zumkeller_, Oct 09 2015
%o A263017 (Python)
%o A263017 from math import comb
%o A263017 def A263017(n):
%o A263017     c, k = 1, 0
%o A263017     for i,j in enumerate(bin(n)[-1:1:-1]):
%o A263017         if j == '1':
%o A263017             k += 1
%o A263017             c += comb(i,k)
%o A263017     return c # _Chai Wah Wu_, Mar 01 2023
%Y A263017 One more than A068076.
%Y A263017 Cf. A000120, A036563, A057168, A254524, A286478, A286552, A286554, A286558.
%Y A263017 Cf. A263109, A263110.
%K A263017 nonn,look,base
%O A263017 1,2
%A A263017 _Paul Tek_, Oct 07 2015