login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(0) = 0; for n > 0, if A003188(n) > A003188(n-1) then a(n) = n-1, else if A003188(n+1) < A003188(n) then a(n) = n+1, otherwise a(n) = 0.
4

%I #10 Dec 20 2018 23:18:20

%S 0,0,1,0,3,4,7,0,7,8,9,12,0,12,15,0,15,16,17,0,19,20,23,24,0,24,25,28,

%T 0,28,31,0,31,32,33,0,35,36,39,0,39,40,41,44,0,44,47,48,0,48,49,0,51,

%U 52,55,56,0,56,57,60,0,60,63,0,63,64,65,0,67,68,71,0,71,72,73,76,0,76,79,0,79,80,81,0,83,84,87,88,0,88,89

%N a(0) = 0; for n > 0, if A003188(n) > A003188(n-1) then a(n) = n-1, else if A003188(n+1) < A003188(n) then a(n) = n+1, otherwise a(n) = 0.

%C For all n, A207901(a(n)) divides A207901(n), and similarly for A302033.

%H Antti Karttunen, <a href="/A322017/b322017.txt">Table of n, a(n) for n = 0..16383</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%t g[n_] := BitXor[n, Floor[n/2]]; a[n_] := If[n == 0, 0, If[g[n] > g[n-1], n-1, If[g[n+1] < g[n], n+1, 0]]]; Array[a, 100, 0] (* _Amiram Eldar_, Dec 05 2018 *)

%o (PARI)

%o A003188(n) = bitxor(n, n>>1);

%o A322017(n) = if(0==n, 0, if(A003188(n)>A003188(n-1), n-1, if(A003188(1+n) < A003188(n), n+1, 0)));

%Y Cf. A003188, A322015, A322016, A322018.

%Y Cf. also A207901, A302033.

%K nonn

%O 0,5

%A _Antti Karttunen_, Nov 24 2018