OFFSET
1
COMMENTS
LINKS
EXAMPLE
a(341) = 1 as 2^340 mod 341 is 1.
MAPLE
[0, seq(`if`(2 &^ (n-1) mod n = 1, 1, 0), n = 2..104)]; # Peter Luschny, Sep 19 2017
MATHEMATICA
f[n_] := If[PowerMod[2, n - 1, n] == 1, 1, 0]; Array[f, 105] (* Robert G. Wilson v, Apr 28 2015 *)
PROG
(PARI) A257531(n) = if(n==1, 0, if(Mod(2, n)^(n-1)==1, 1, 0)); \\ Antti Karttunen, Michel Marcus & Altug Alkan, Sep 13-20 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Gerald Hillier, Apr 28 2015
STATUS
approved