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.

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

This page as a plain text file.
%I A182242 #28 Feb 16 2025 08:33:13
%S A182242 0,1,2,1,4,1,6,5,8,1,10,1,12,9,6,5,16,1,18,1,20,1,22,5,24,17,10,1,28,
%T A182242 25,22,21,32,1,34,1,36,1,38,5,40,1,42,1,44,9,38,5,48,33,18,1,52,33,22,
%U A182242 5,56,49,42,33,28,25,22,21,64,1,66,1,68,1,70,5,72,1
%N A182242 a(0)=0, a(n) = (a(n-1) + n) AND n.
%C A182242 Indices of 1's (that is, n's such that a(n)=1)
%C A182242 1, 3, 5, 9, 11, 17, 19, 21, 27, 33, 35, 37, 41, 43, 51, 65, 67, 69, 73, 75, 81, 83, 85, 91, 99, 107, 129, 131, 133, 137, 139, 145, 147, 149, 155, 161, 163, 165, 169, 171, 179, 195, 203, 211, 219, 257, 259, 261, 265, etc.
%C A182242 Indices of 5's:
%C A182242 7, 15, 23, 39, 47, 55, 71, 79, 87, 103, 111, 119, 135, 143, 151, 167, 175, 183, 199, 207, 215, 231, 239, 263, 271, 279, 295, 303, 311, 327, 335, 343, 359, 367, 375, 391, 399, 407, 423, 431, 439, 455, 463, 471, 495, 519, etc.
%C A182242 Indices of 9's:
%C A182242 13, 45, 77, 141, 173, 269, 301, 333, 525, 557, 589, 653, 685, 1037, 1069, 1101, 1165, 1197, 1293, 1325, 1357, 2061, 2093, 2125, 2189, 2221, 2317, 2349, 2381, 2573, 2605, 2637, 2701, 2733, 4109, 4141, 4173, 4237, 4269, etc.
%H A182242 Reinhard Zumkeller, <a href="/A182242/b182242.txt">Table of n, a(n) for n = 0..10000</a>
%H A182242 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/AND.html">AND</a>
%H A182242 Wikipedia, <a href="http://en.wikipedia.org/wiki/Binary_and#AND">Bitwise operation AND</a>
%F A182242 a(0)=0, a(n)=(a(n-1)+n) AND n, where AND is the bitwise logical AND operator.
%t A182242 Join[{t = 0}, Table[t = BitAnd[(t + n), n], {n, 100}]] (* _T. D. Noe_, Apr 21 2012 *)
%o A182242 (Python)
%o A182242 a=0
%o A182242 for i in range(1,511):
%o A182242     print(a, end=',')
%o A182242     a += i
%o A182242     a &= i
%o A182242 (Haskell)
%o A182242 import Data.Bits ((.&.))
%o A182242 a182242 n = a182242_list !! n
%o A182242 a182242_list = map fst $ iterate f (0,1) where
%o A182242    f (y,x) = ((x + y) .&. x, x + 1) :: (Integer,Integer)
%o A182242 -- _Reinhard Zumkeller_, Apr 23 2012
%Y A182242 Cf. A182243.
%K A182242 nonn,base,look
%O A182242 0,3
%A A182242 _Alex Ratushnyak_, Apr 20 2012