[go: up one dir, main page]

login
A137671
a(n+1) is the number of preceding terms having in binary representation the same number of ones as a(n), starting with a(1) = 1.
5
1, 1, 2, 3, 1, 4, 5, 2, 6, 3, 4, 7, 1, 8, 9, 5, 6, 7, 2, 10, 8, 11, 3, 9, 10, 11, 4, 12, 12, 13, 5, 14, 6, 15, 1, 13, 7, 8, 14, 9, 16, 15, 2, 16, 17, 17, 18, 19, 10, 20, 21, 11, 12, 22, 13, 14, 15, 3, 23, 4, 18, 24, 25, 16, 19, 17, 26, 18, 27, 5, 28, 19, 20, 29, 6, 30, 7, 21, 22, 23, 8
OFFSET
1,3
FORMULA
A137672(n) = A000120(a(n)).
a(A137673(n)) = n and a(m) < n for m < A137673(n).
a(n) = 1 iff a(n-1) = 2^k - 1: a(A137674(n)) = 1.
EXAMPLE
n=4: a(3) = 2 = '10', A000120(2) = 1, therefore: a(4) = #{a(1)=1='1', a(2)=1, a(3)=2='10'} = 3;
n=5: a(4) = 3 = '11', A000120(3) = 2, therefore: a(5) = #{a(4)} = 1;
n=6: a(5) = 1 = '1', A000120(1) = 1, therefore: a(6) = #{a(1)=1='1', a(2)=1, a(3)=2='10', a(5)} = 4.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Count[Array[s, n-1], s[n-1]]; s[n_] := s[n] = DigitCount[a[n], 2, 1]; Array[a, 100] (* Amiram Eldar, Jul 27 2023 *)
PROG
(PARI) lista(nn) = my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = #select(x->hammingweight(x)==hammingweight(va[n-1]), Vec(va, n-1)); ); va; \\ Michel Marcus, Jul 28 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Feb 05 2008
EXTENSIONS
Name edited by Michel Marcus, Jul 28 2023
STATUS
approved