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.

A226221 Numbers n such that 2^n mod n is not a power of 2.

This page as a plain text file.
%I A226221 #15 Feb 28 2022 12:50:10
%S A226221 1,2,4,8,16,18,25,27,32,35,36,42,45,49,50,54,55,64,70,75,77,81,88,91,
%T A226221 95,98,99,100,104,105,108,110,115,117,119,121,125,128,130,135,136,140,
%U A226221 143,147,150,152,153,155,156,160,161,162,169,171,175,180,184,187,189,190,198,200
%N A226221 Numbers n such that 2^n mod n is not a power of 2.
%C A226221 All terms beyond the first two are composite: this is a subsequence of A065090.
%H A226221 Charles R Greathouse IV, <a href="/A226221/b226221.txt">Table of n, a(n) for n = 1..10000</a>
%e A226221 2^18 = 262144 = 10 mod 18 and 10 is not a power of 2, so 18 is in the sequence.
%p A226221 isA226221 := proc(n)
%p A226221     local m ;
%p A226221     if n <= 2 then
%p A226221         return true;
%p A226221     end if;
%p A226221     m := A015910(n) ;
%p A226221     if type(m,'odd') or m = 0 then
%p A226221         true;
%p A226221     elif nops(numtheory[factorset](m))  >1 then
%p A226221         true;
%p A226221     else
%p A226221         false;
%p A226221     end if;
%p A226221 end proc:
%p A226221 A226221 := proc(n)
%p A226221     local a;
%p A226221     if n <= 2 then
%p A226221         n;
%p A226221     else
%p A226221         for a from procname(n-1)+1 do
%p A226221             if isA226221(a) then
%p A226221                 return a;
%p A226221             end if;
%p A226221         end do:
%p A226221     end if;
%p A226221 end proc:
%p A226221 seq(A226221(n),n=1..30) ; # _R. J. Mathar_, Jun 06 2013
%t A226221 Select[Range[200],!IntegerQ[Log[2,PowerMod[2,#,#]]]&] (* _Harvey P. Dale_, Feb 28 2022 *)
%o A226221 (PARI) ispow2(n)=n>0 && n==1<<valuation(n,2)
%o A226221 is(n)=!ispow2(lift(Mod(2,n)^n))
%Y A226221 Cf. A015910, A015911.
%K A226221 nonn
%O A226221 1,2
%A A226221 _J. M. Bergot_ and _Charles R Greathouse IV_, May 31 2013