OFFSET
1,1
COMMENTS
All terms are even.
a(2n) = 2*a(n) for any n>0.
Without the condition on m being a multiple of n, then we'd get another sequence b(n) that seems to be A006519(n+1). - Michel Marcus, Sep 06 2015
LINKS
Paul Tek, Table of n, a(n) for n = 1..16384
FORMULA
a(n) = n*A261891(n) for any n>0.
EXAMPLE
For n=7:
+---+-----+---------------+-----------------+
| k | 7*k | 7*k in binary | Common one bits |
+---+-----+---------------+-----------------+
| 1 | 7 | 111 | 111 |
| 2 | 14 | 1110 | 110 |
| 3 | 21 | 10101 | 101 |
| 4 | 28 | 11100 | 100 |
| 5 | 35 | 100011 | 11 |
| 6 | 42 | 101010 | 10 |
| 7 | 49 | 110001 | 1 |
| 8 | 56 | 111000 | 0 |
+---+-----+---------------+-----------------+
Hence, a(7) = 56.
MATHEMATICA
Table[k = 1; While[BitAnd[k n, n] != 0, k++]; k n, {n, 60}] (* Michael De Vlieger, Sep 06 2015 *)
PROG
(Perl) sub a {
my $n = shift;
my $m = $n;
while ($n & $m) {
$m += $n;
}
return $m;
}
(PARI) a(n) = {k=1; while (bitand(n, k*n), k++); k*n; } \\ Michel Marcus, Sep 06 2015
(Python)
from itertools import count
def A261892(n): return next(k for k in count(n<<1, n) if not n&k) # Chai Wah Wu, Jul 19 2024
CROSSREFS
KEYWORD
AUTHOR
Paul Tek, Sep 05 2015
STATUS
approved