login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
-- Reinhard Zumkeller, Apr 29 2012
CROSSREFS
Sequence in context: A054278 A210978 A211434 * A080335 A351837 A089109
KEYWORD
nonn,base
AUTHOR
Alex Ratushnyak, Apr 27 2012
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 23 01:12 EST 2024. Contains 370265 sequences. (Running on oeis4.)