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.

A253719 Least k>0 such that n AND (n^k) <= 1, where AND denotes the bitwise AND operator.

This page as a plain text file.
%I A253719 #16 May 03 2015 17:54:06
%S A253719 1,1,2,2,2,2,3,2,2,2,2,4,2,4,4,2,2,2,2,2,3,6,5,4,2,4,2,8,3,8,5,2,2,2,
%T A253719 2,2,2,2,3,6,2,2,4,12,2,4,4,4,2,4,2,10,3,14,6,8,2,8,6,16,3,16,6,2,2,2,
%U A253719 2,2,2,2,4,2,3,4,4,4,2,4,4,6,2,2,5,8,4
%N A253719 Least k>0 such that n AND (n^k) <= 1, where AND denotes the bitwise AND operator.
%C A253719 This sequence is well defined: for any n such that n < 2^m:
%C A253719 - If n is even, then n^m = 0 mod 2^m, hence n AND (n^m) = 0, and a(n) <= m,
%C A253719 - If n is odd, then n^phi(2^m) = 1 mod 2^m according to Euler's totient theorem, hence n AND (n^phi(2^m)) = 1, and a(n) <= phi(2^m).
%C A253719 a(2*(2^m-1)) = m+1 for any m>=0. - _Paul Tek_, May 03 2015
%H A253719 Paul Tek, <a href="/A253719/b253719.txt">Table of n, a(n) for n = 0..100000</a>
%e A253719 11 AND (11^1) = 11,
%e A253719 11 AND (11^2) = 9,
%e A253719 11 AND (11^3) = 3,
%e A253719 11 AND (11^4) = 1,
%e A253719 hence a(11)=4.
%o A253719 (PARI) a(n) = my(k=1, nk=n); while (bitand(n, nk)>1, k=k+1; nk=nk*n); return (k)
%Y A253719 Cf. A224694.
%K A253719 nonn,base
%O A253719 0,3
%A A253719 _Paul Tek_, May 02 2015