login
A322017
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
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, 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, 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
OFFSET
0,5
COMMENTS
For all n, A207901(a(n)) divides A207901(n), and similarly for A302033.
MATHEMATICA
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 *)
PROG
(PARI)
A003188(n) = bitxor(n, n>>1);
A322017(n) = if(0==n, 0, if(A003188(n)>A003188(n-1), n-1, if(A003188(1+n) < A003188(n), n+1, 0)));
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 24 2018
STATUS
approved