Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #23 Jan 15 2018 14:01:05
%S 1,1,1,4,1,1,4,1,1,4,1,16,13,1,1,4,9,1,4,1,1,31,1,15,4,1,49,4,1,1,4,
%T 16,1,4,1,1,34,9,1,40,1,16,4,1,64,4,54,1,58,1,1,46,1,1,4,1,39,22,30,
%U 56,4,91,1,4,1,64,94,1,1,4,114,16,25,1,1,103,109,1,4,156,1,16,1,40,85,1,134
%N a(n) = 2^(2*n) mod (2*n+1).
%C It is known that a(n) equals 1 when 2*n+1 is prime as a result of Fermat's little theorem. If not then a(n) equals 1 when 2*n+1 is a pseudoprime to base 2.
%H Alois P. Heinz, <a href="/A177023/b177023.txt">Table of n, a(n) for n = 1..20000</a> (first 5000 terms from Muniru A Asiru)
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Fermat%27s_little_theorem">Fermat's little theorem</a>
%F a(n) = 2^(2*n) mod (2*n+1) or a(n) = 4^n mod (2*n+1)
%e a(3) = 2^(2 * 3) mod (2 * 3 + 1) = 64 mod 7 = 1.
%e a(4) = 2^(2 * 4) mod (2 * 4 + 1) = 256 mod 9 = 4.
%e a(5) = 2^(2 * 5) mod (2 * 5 + 1) = 1024 mod 11 = 1.
%p seq(2&^(2*n) mod (2*n + 1), n=1..10^2); # _Muniru A Asiru_, Jan 14 2018
%t Table[PowerMod[2, 2n, 2n + 1], {n, 90}] (* _Harvey P. Dale_, May 09 2012 *)
%o (Literate Haskell) > map (\k -> 2^(2*k) `mod` (2*k+1)) [1..100]
%o (GAP) A177023 := List([1..10^3], n -> 2^(2*n) mod (2*n + 1)); # _Muniru A Asiru_, Jan 14 2018
%o (PARI) a(n) = lift(Mod(4, 2*n+1)^n); \\ _Michel Marcus_, Jan 15 2018
%Y Cf. A000040, A001567.
%K easy,nonn
%O 1,4
%A Nikolay Ulyanov (ulyanick(AT)gmail.com), May 01 2010