OFFSET
0,3
COMMENTS
Indices of 1's (that is, n's such that a(n)=1)
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.
Indices of 5's:
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.
Indices of 9's:
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.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Eric Weisstein's World of Mathematics, AND
Wikipedia, Bitwise operation AND
FORMULA
a(0)=0, a(n)=(a(n-1)+n) AND n, where AND is the bitwise logical AND operator.
MATHEMATICA
Join[{t = 0}, Table[t = BitAnd[(t + n), n], {n, 100}]] (* T. D. Noe, Apr 21 2012 *)
PROG
(Python)
a=0
for i in range(1, 511):
print(a, end=', ')
a += i
a &= i
(Haskell)
import Data.Bits ((.&.))
a182242 n = a182242_list !! n
a182242_list = map fst $ iterate f (0, 1) where
f (y, x) = ((x + y) .&. x, x + 1) :: (Integer, Integer)
-- Reinhard Zumkeller, Apr 23 2012
CROSSREFS
KEYWORD
AUTHOR
Alex Ratushnyak, Apr 20 2012
STATUS
approved