cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A116361 Smallest k such that n XOR n*2^k = n*(2^k + 1).

This page as a plain text file.
%I A116361 #14 Jul 19 2024 18:34:41
%S A116361 0,1,1,2,1,1,2,3,1,1,1,4,2,4,3,4,1,1,1,2,1,1,4,5,2,2,4,5,3,5,4,5,1,1,
%T A116361 1,2,1,1,2,6,1,1,1,6,4,4,5,6,2,2,2,2,4,6,5,6,3,6,5,6,4,6,5,6,1,1,1,2,
%U A116361 1,1,2,3,1,1,1,4,2,5,6,7,1,1,1,7,1,1,6,7,4,5,4,7,5,5,6,7,2,2,2,2,2,7,2,7,4
%N A116361 Smallest k such that n XOR n*2^k = n*(2^k + 1).
%C A116361 a(A003714(n)) <= 1;
%C A116361 a(A048716(n)) <= 2;
%C A116361 a(A115845(n)) <= 3;
%C A116361 a(A115847(n)) <= 4;
%C A116361 a(A114086(n)) <= 5;
%C A116361 a(A116362(n)) = n and a(m) < n for m < A116362(n).
%H A116361 Charles R Greathouse IV, <a href="/A116361/b116361.txt">Table of n, a(n) for n = 0..10000</a>
%t A116361 a[n_] := Module[{k}, For[k = 0, True, k++,
%t A116361      If[BitXor[n, n*2^k] == n*(2^k+1), Return[k]]]];
%t A116361 Table[a[n], {n, 0, 104}] (* _Jean-François Alcover_, Nov 19 2021 *)
%o A116361 (PARI) a(n)=my(k);while(bitxor(n,n<<k)-n!=n<<k,k++);k \\ _Charles R Greathouse IV_, Mar 07 2013
%o A116361 (Python)
%o A116361 from itertools import count
%o A116361 def A116361(n): return next(k for k in count(0) if n^(m:=n<<k)==m+n) # _Chai Wah Wu_, Jul 19 2024
%K A116361 nonn,easy
%O A116361 0,4
%A A116361 _Reinhard Zumkeller_, Feb 04 2006
%E A116361 Offset corrected by _Charles R Greathouse IV_, Mar 07 2013