Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #22 Jul 19 2024 19:08:45
%S 2,2,4,2,2,4,8,2,2,2,12,4,10,8,16,2,2,2,4,2,2,12,24,4,4,10,12,8,10,16,
%T 32,2,2,2,4,2,2,4,40,2,2,2,12,12,10,24,48,4,4,4,4,10,34,12,56,8,18,10,
%U 12,16,42,32,64,2,2,2,4,2,2,4,8,2,2,2,12,4,10
%N Least k>0 such that n AND (k*n) = 0, where AND stands for the binary AND operator.
%C All terms are even.
%C a(A003714(n)) = 2 for any n>0.
%C a(A004780(n)) > 2 for any n>0.
%C a(n) <= 2^A116361(n) for any n>0.
%C a(2n) = a(n) for any n>0.
%H Paul Tek, <a href="/A261891/b261891.txt">Table of n, a(n) for n = 1..16384</a>
%e For n=7:
%e +---+-------------+
%e | k | 7 AND (k*7) |
%e | | (in binary) |
%e +---+-------------+
%e | 1 | 111 |
%e | 2 | 110 |
%e | 3 | 101 |
%e | 4 | 100 |
%e | 5 | 11 |
%e | 6 | 10 |
%e | 7 | 1 |
%e | 8 | 0 |
%e +---+-------------+
%e Hence, a(7) = 8.
%t Table[k = 1; While[BitAnd[k n, n] != 0, k++]; k, {n, 60}] (* _Michael De Vlieger_, Sep 06 2015 *)
%o (Perl) sub a {
%o my $n = shift;
%o my $k = 1;
%o while ($n & ($k*$n)) {
%o $k++;
%o }
%o return $k;
%o }
%o (PARI) a(n) = {k=1; while (bitand(n, k*n), k++); k;} \\ _Michel Marcus_, Sep 06 2015
%o (Python)
%o from itertools import count
%o def A261891(n): return next(k for k in count(2) if not n&k*n) # _Chai Wah Wu_, Jul 19 2024
%Y Cf. A003714, A004780, A116361, A261892.
%K nonn,base,look
%O 1,1
%A _Paul Tek_, Sep 05 2015