cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A182388 a(0) = 1, a(n) = (a(n-1) XOR n) + n.

This page as a plain text file.
%I A182388 #21 Apr 16 2025 09:03:53
%S A182388 1,1,5,9,17,25,37,41,41,41,45,49,73,81,109,113,113,113,117,121,129,
%T A182388 169,213,217,217,217,221,225,281,289,349,353,353,353,357,361,369,377,
%U A182388 389,457,521,585,653,721,809,817,845,913,977,1041,1109,1177,1249
%N A182388 a(0) = 1, a(n) = (a(n-1) XOR n) + n.
%C A182388 a(n)>=n.
%H A182388 Reinhard Zumkeller, <a href="/A182388/b182388.txt">Table of n, a(n) for n = 0..10000</a>
%H A182388 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/XOR.html">XOR</a>
%H A182388 Wikipedia, <a href="http://en.wikipedia.org/wiki/Binary_and#XOR">Bitwise operation XOR</a>
%F A182388 a(0) = 1, a(n) = (a(n-1) XOR n) + n, where XOR is the bitwise exclusive-OR operator.
%e A182388 a(5) = (a(4) XOR 5) + 5 = (17 XOR 5) + 5 = 20 + 5 = 25.
%t A182388 FoldList[BitXor[#, #2] + #2 &, 1, Range[100]] (* _Paolo Xausa_, Apr 16 2025 *)
%o A182388 (Python)
%o A182388 a=1
%o A182388 for i in range(1,55):
%o A182388     print(a, end=', ')
%o A182388     a ^= i
%o A182388     a += i
%o A182388 (Haskell)
%o A182388 import Data.Bits (xor)
%o A182388 a182388 n = a182388_list !! n
%o A182388 a182388_list = f 0 1 where
%o A182388    f x y = y' : f (x + 1) y' :: [Integer] where y' = (x `xor` y) + x
%o A182388 -- _Reinhard Zumkeller_, Apr 29 2012
%Y A182388 Cf. A182243, A182248.
%K A182388 nonn,base
%O A182388 0,3
%A A182388 _Alex Ratushnyak_, Apr 27 2012