OFFSET
0,10
LINKS
John Tyler Rascoe, Table of n, a(n) for n = 0..8192
EXAMPLE
For n= 9, we have (with leading zeros written) 0 through 9 in binary:
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
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.
MAPLE
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
PROG
(Python)
from collections import Counter
def bin_i(n): #binary indices
return([(i) for i, x in enumerate(bin(n)[2:][::-1]) if x =='1'])
def A141612_list(n_max):
A, C = [], Counter()
for n in range(n_max+1):
for i in bin_i(n): C.update({i})
B, x = list(C.values()), 0
for k in B:
if B.count(k) == 1: x += 1
A.append(x)
return(A) # John Tyler Rascoe, Feb 09 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Leroy Quet, Aug 22 2008
EXTENSIONS
Extended by R. J. Mathar, Sep 12 2008
STATUS
approved