A160700 a(n) = if n<16 then n else a(floor(n/16)) XOR (n mod 16).
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9, 14, 15, 12, 13, 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, 4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11, 5, 4, 7, 6, 1, 0, 3, 2, 13
Offset: 0
Links
- R. Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
Haskell
import Data.Bits (xor) a160700 n = a160700_list !! n a160700_list = [0..15] ++ map f [16..] where f x = a160700 x' `xor` m :: Int where (x', m) = divMod x 16 -- Reinhard Zumkeller, Nov 07 2012
-
Maple
read("transforms") ; A160700 := proc(n) if n < 16 then n; else XORnos(procname(floor(n/16)),modp(n,16)) end if; end proc: # R. J. Mathar, Jul 12 2016
-
Mathematica
a[n_] := a[n] = If[n < 16, n, a[Floor[n/16]] ~BitXor~ Mod[n, 16]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 25 2018 *)
-
Maxima
load(functs)$ A160700(n):=if n<16 then n else logxor(floor(n/16),mod(n,16))$ makelist(A160700(n),n,0,60); /* Martin Ettl, Nov 05 2012 */
-
PARI
a(n)=my(t=n%16); while(n>15, n>>=4; t=bitxor(t, n%16)); t \\ Charles R Greathouse IV, Jan 25 2018
Comments