login
A322016
a(0) = 0; for n > 0, if A003188(n) > A003188(n-1) then a(n) = n-1, otherwise a(n) = 0.
3
0, 0, 1, 0, 3, 4, 0, 0, 7, 8, 9, 0, 0, 12, 0, 0, 15, 16, 17, 0, 19, 20, 0, 0, 0, 24, 25, 0, 0, 28, 0, 0, 31, 32, 33, 0, 35, 36, 0, 0, 39, 40, 41, 0, 0, 44, 0, 0, 0, 48, 49, 0, 51, 52, 0, 0, 0, 56, 57, 0, 0, 60, 0, 0, 63, 64, 65, 0, 67, 68, 0, 0, 71, 72, 73, 0, 0, 76, 0, 0, 79, 80, 81, 0, 83, 84, 0, 0, 0, 88, 89, 0, 0, 92, 0, 0, 0, 96, 97
OFFSET
0,5
FORMULA
a(0) = 0; for n > 0, a(n) = (1/2)*(A034947(n)+1)*(n-1).
MATHEMATICA
With[{nn = 98}, {0, 0}~Join~Most@ ReplacePart[ConstantArray[0, nn], Map[# -> # &, Position[Partition[Array[BitXor[#, Floor[#/2]] &, nn], 2, 1], _?(First@ # < Last@ # &), {1}, Heads -> False][[All, 1]] ]]] (* Michael De Vlieger, Nov 25 2018 *)
Join[{0, 0}, With[{t=Partition[Table[BitXor[n, Floor[n/2]], {n, 100}], 2, 1]}, Flatten[ If[#[[1]]<#[[2]], Position[t, #], 0]&/@t]]] (* Harvey P. Dale, Jan 28 2021 *)
PROG
(PARI)
A003188(n) = bitxor(n, n>>1);
A322016(n) = if(0==n, 0, if(A003188(n)>A003188(n-1), n-1, 0));
(PARI) A322016(n) = if(!n, 0, (((kronecker(-1, n)+1)/2)*(n-1)));
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 24 2018
STATUS
approved