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!)
A182242 a(0)=0, a(n) = (a(n-1) + n) AND n. 5

%I #27 May 02 2021 21:43:34

%S 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 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 5,56,49,42,33,28,25,22,21,64,1,66,1,68,1,70,5,72,1

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

%C Indices of 1's (that is, n's such that a(n)=1)

%C 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 Indices of 5's:

%C 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 Indices of 9's:

%C 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 Reinhard Zumkeller, <a href="/A182242/b182242.txt">Table of n, a(n) for n = 0..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/AND.html">AND</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Binary_and#AND">Bitwise operation AND</a>

%F a(0)=0, a(n)=(a(n-1)+n) AND n, where AND is the bitwise logical AND operator.

%t Join[{t = 0}, Table[t = BitAnd[(t + n), n], {n, 100}]] (* _T. D. Noe_, Apr 21 2012 *)

%o (Python)

%o a=0

%o for i in range(1,511):

%o print(a, end=',')

%o a += i

%o a &= i

%o (Haskell)

%o import Data.Bits ((.&.))

%o a182242 n = a182242_list !! n

%o a182242_list = map fst $ iterate f (0,1) where

%o f (y,x) = ((x + y) .&. x, x + 1) :: (Integer,Integer)

%o -- _Reinhard Zumkeller_, Apr 23 2012

%Y Cf. A182243.

%K nonn,base,look

%O 0,3

%A _Alex Ratushnyak_, Apr 20 2012

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 April 18 18:58 EDT 2024. Contains 371781 sequences. (Running on oeis4.)