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.

A182243 a(0)=0, a(n) = (a(n-1) AND n) + n.

This page as a plain text file.
%I A182243 #26 Feb 16 2025 08:33:13
%S A182243 0,1,2,5,8,5,10,9,16,9,18,13,24,21,18,17,32,17,34,21,40,21,42,25,48,
%T A182243 41,34,29,56,53,50,49,64,33,66,37,72,37,74,41,80,41,82,45,88,53,82,49,
%U A182243 96,81,66,53,104,85,74,57,112,105,98,93,88,85,82,81,128,65
%N A182243 a(0)=0, a(n) = (a(n-1) AND n) + n.
%H A182243 Reinhard Zumkeller, <a href="/A182243/b182243.txt">Table of n, a(n) for n = 0..8192=2^13</a>
%H A182243 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/AND.html">AND</a>
%H A182243 Wikipedia, <a href="http://en.wikipedia.org/wiki/Binary_and#AND">Bitwise operation AND</a>
%F A182243 a(0) = 0, a(n) = (a(n-1) AND n) + n, where AND is the bitwise logical AND operator.
%t A182243 Join[{t = 0}, Table[t = BitAnd[t, n] + n, {n, 100}]] (* _T. D. Noe_, Apr 21 2012 *)
%o A182243 (Python)
%o A182243 a=0
%o A182243 for i in range(1,511):
%o A182243     print(a, end=',')
%o A182243     a &= i
%o A182243     a += i
%o A182243 (Haskell)
%o A182243 import Data.Bits ((.&.))
%o A182243 a182243 n = a182243_list !! n
%o A182243 a182243_list = map fst $ iterate f (0,1) where
%o A182243    f (y,x) = ((x .&. y) + x, x + 1) :: (Integer,Integer)
%o A182243 -- _Reinhard Zumkeller_, Apr 23 2012
%Y A182243 Cf. A182242.
%K A182243 nonn,base,look
%O A182243 0,3
%A A182243 _Alex Ratushnyak_, Apr 20 2012