|
| |
|
|
A129760
|
|
Bitwise AND of n-1 and n written in base 2.
|
|
5
| |
|
|
0, 0, 2, 0, 4, 4, 6, 0, 8, 8, 10, 8, 12, 12, 14, 0, 16, 16, 18, 16, 20, 20, 22, 16, 24, 24, 26, 24, 28, 28, 30, 0, 32, 32, 34, 32, 36, 36, 38, 32, 40, 40, 42, 40, 44, 44, 46, 32, 48, 48, 50, 48, 52, 52, 54, 48, 56, 56, 58, 56, 60, 60, 62, 0, 64, 64, 66, 64, 68, 68, 70, 64, 72, 72, 74
(list; graph; refs; listen; history; internal format)
|
|
|
|
OFFSET
| 1,3
|
|
|
COMMENTS
| Also the number of Ducci sequences with period n.
Also largest number less than n having in binary representation fewer ones than n has; A048881(n-1) = A000120(a(n)) = A000120(n)-1. [From Reinhard Zumkeller, Jun 30 2010]
|
|
|
REFERENCES
| R. Brown and J. L. Merzel, The number of Ducci sequences with a given period, Fib. Quart., 45 (2007), 115-121.
|
|
|
LINKS
| R. Zumkeller, Table of n, a(n) for n = 1..10000
|
|
|
FORMULA
| a(n) = n AND n-1
Equals n - A006519(n). - N. J. A. Sloane, May 26 2008
From Johannes W. Meijer, Jun 22 2011: (Start)
a((2*n-1)*2^p) = (2*n-2)*(2^p), n>=1, p>=0.
a(2*n-1) = (2*n-2), n>=1, and a(2^p+1) = 2^p, p>=1. (End)
|
|
|
EXAMPLE
| a(6) = 6 AND 5 = binary 110 AND 101 = binary 100 = 4.
|
|
|
MAPLE
| nmax := 75; pmax := ceil(log(nmax)/log(2)); for p from 0 to pmax do for n from 1 to nmax do a((2*n-1)*2^p) := (2*n-2) * 2^p: od: od: seq(a(n), n=1..nmax); [Johannes W. Meijer, Jun 22 2011]
|
|
|
MATHEMATICA
| Table[BitAnd[n, n - 1], {n, 1, 100}] (* From Vladimir Joseph Stephan Orlovsky, Jul 19 2011 *)
|
|
|
PROG
| (C) int a(int n) { return n & (n-1); }
(PARI) a(n)=bitand(n, n-1) \\ Charles R Greathouse IV, Jun 23 2011
|
|
|
CROSSREFS
| Cf. A038712, A086799, A104594, A059991, A006519.
Cf. A109168. [Johannes W. Meijer, Jun 22 2011]
Sequence in context: A134271 A094403 A166085 * A057377 A145811 A131772
Adjacent sequences: A129757 A129758 A129759 * A129761 A129762 A129763
|
|
|
KEYWORD
| easy,nonn
|
|
|
AUTHOR
| Russ Cox (rsc(AT)swtch.com), May 15 2007
|
| |
|
|