login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(0) = 0, and for any n > 0, a(n) = n - a(k) where k is the greatest number < n such that n AND a(k) = a(k) (where AND denotes the bitwise AND operator).
1

%I #10 Feb 18 2021 00:18:29

%S 0,1,2,1,4,1,2,5,8,1,2,9,4,9,10,5,16,1,2,17,4,17,18,5,8,17,18,9,20,9,

%T 10,21,32,1,2,33,4,33,34,5,8,33,34,9,36,9,10,37,16,33,34,17,36,17,18,

%U 37,40,17,18,41,20,41,42,21,64,1,2,65,4,65,66,5,8,65

%N a(0) = 0, and for any n > 0, a(n) = n - a(k) where k is the greatest number < n such that n AND a(k) = a(k) (where AND denotes the bitwise AND operator).

%C This sequence is a binary variant of A341679; here we look for a term whose binary 1's match those of n, there we look for a term that divides n.

%H Rémy Sigrist, <a href="/A341691/b341691.txt">Table of n, a(n) for n = 0..8191</a>

%H Rémy Sigrist, <a href="/A341691/a341691.txt">C program for A341691</a>

%F a(n) = n iff n = 0 or n is a power of 2.

%F a(2*n) = 2*a(n).

%F Apparently, a(n) = n - a(n - A006519(n)).

%e The first terms, alongside the corresponding value of k, are:

%e n a(n) k

%e -- ---- ---

%e 0 0 N/A

%e 1 1 0

%e 2 2 0

%e 3 1 2

%e 4 4 0

%e 5 1 4

%e 6 2 4

%e 7 5 6

%e 8 8 0

%e 9 1 8

%o (C) See Links section.

%Y Cf. A006519, A295989, A341679.

%K nonn,base

%O 0,3

%A _Rémy Sigrist_, Feb 17 2021