|
|
A182388
|
|
a(0)=1, a(n) = (a(n-1) XOR n) + n.
|
|
1
|
|
|
1, 1, 5, 9, 17, 25, 37, 41, 41, 41, 45, 49, 73, 81, 109, 113, 113, 113, 117, 121, 129, 169, 213, 217, 217, 217, 221, 225, 281, 289, 349, 353, 353, 353, 357, 361, 369, 377, 389, 457, 521, 585, 653, 721, 809, 817, 845, 913, 977, 1041, 1109, 1177, 1249
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
a(n)>=n.
|
|
LINKS
|
Eric Weisstein's World of Mathematics, XOR
|
|
FORMULA
|
a(0)=1, a(n)=(a(n-1) XOR n) + n, where XOR is the bitwise exclusive-OR operator.
|
|
EXAMPLE
|
a(5) = (a(4) XOR 5) + 5 = (17 XOR 5) + 5 = 20+5 = 25
|
|
PROG
|
(Python)
a=1
for i in range(1, 55):
. print a,
. a ^= i
. a += i
(Haskell)
import Data.Bits (xor)
a182388 n = a182388_list !! n
a182388_list = f 0 1 where
f x y = y' : f (x + 1) y' :: [Integer] where y' = (x `xor` y) + x
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|