login
A182242
a(0)=0, a(n) = (a(n-1) + n) AND n.
5
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, 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, 5, 56, 49, 42, 33, 28, 25, 22, 21, 64, 1, 66, 1, 68, 1, 70, 5, 72, 1
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
Eric Weisstein's World of Mathematics, 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
Cf. A182243.
Sequence in context: A146386 A305098 A128099 * A261605 A239093 A263453
KEYWORD
nonn,base,look
AUTHOR
Alex Ratushnyak, Apr 20 2012
STATUS
approved