login
Write down 0,1,2,3,...n each in binary. Total up the number of 1's in each bit-position (total number of 1's in 1's position, total number of 1's in 2's position, total number of 1's in 4's position, etc.). a(n) = the number of such totals that each do not equal any other such total.
1

%I #15 Feb 10 2024 03:07:06

%S 0,1,0,0,1,1,0,0,1,2,2,0,0,1,0,0,1,2,1,1,3,3,2,0,0,1,1,0,0,1,0,0,1,2,

%T 1,1,2,2,1,1,3,4,4,2,2,3,2,0,0,1,0,0,2,2,1,0,0,1,1,0,0,1,0,0,1,2,1,1,

%U 2,2,1,1,2,3,3,1,1,2,1,1,3,4,3,3,5,5,4,2,2,3,3,2,2,3,2,0,0,1,0,0,1,1,0,0,2

%N Write down 0,1,2,3,...n each in binary. Total up the number of 1's in each bit-position (total number of 1's in 1's position, total number of 1's in 2's position, total number of 1's in 4's position, etc.). a(n) = the number of such totals that each do not equal any other such total.

%H John Tyler Rascoe, <a href="/A141612/b141612.txt">Table of n, a(n) for n = 0..8192</a>

%e For n= 9, we have (with leading zeros written) 0 through 9 in binary:

%e 0000

%e 0001

%e 0010

%e 0011

%e 0100

%e 0101

%e 0110

%e 0111

%e 1000

%e 1001

%e The number of 1's in the ones position (the rightmost position) is 5. The number of 1's in the 2's position (second position from the right) is 4. The number of 1's in the 4's position is 4. The number of 1's in the 8's position (the leftmost position here) is 2. Now, the total 4 occurs twice. But the total 2 occurs once, as does the total 5. Since two totals occur once each, then a(9) = 2.

%p A070939 := proc(n) max(1,ilog2(n)+1) ; end: A141612aux := proc(L,c) local a,i ; a := 0 ; for i in L do a := a+1-min(1,abs(i-c)) ; od; a ; end: A141612 := proc(n) local a,k,p,bds,i; if n = 0 then RETURN(0) ; fi; a := [seq(0,i=1..A070939(n))]; for k from 0 to n do bds := convert(k,base,2) ; for p from 1 to nops(bds) do a := subsop( p=op(p,a)+op(p,bds),a) ; od: od: bds := 0 ; for i in a do if A141612aux(a,i) = 1 then bds := bds+1; fi; od; bds; end: for n from 0 to 120 do printf("%d,",A141612(n)) ; od: # _R. J. Mathar_, Sep 12 2008

%o (Python)

%o from collections import Counter

%o def bin_i(n): #binary indices

%o return([(i) for i, x in enumerate(bin(n)[2:][::-1]) if x =='1'])

%o def A141612_list(n_max):

%o A,C = [],Counter()

%o for n in range(n_max+1):

%o for i in bin_i(n): C.update({i})

%o B,x = list(C.values()),0

%o for k in B:

%o if B.count(k) == 1: x += 1

%o A.append(x)

%o return(A) # _John Tyler Rascoe_, Feb 09 2024

%Y Cf. A000120, A070939.

%K nonn,base,easy

%O 0,10

%A _Leroy Quet_, Aug 22 2008

%E Extended by _R. J. Mathar_, Sep 12 2008