The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A257531 If 2^(n-1) mod n = 1, then 1 else 0. 3
 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1 COMMENTS This first differs from A010051 (1 if n is prime, else 0) at the second term. The next position differing from A010051 is at the 341st term, and further divergences appear for odd pseudoprimes to base 2 (A001567). LINKS Antti Karttunen, Table of n, a(n) for n = 1..68101 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 Characteristic function for A176997 (without its initial 1). Cf. A001567, A010051, A062173. Sequence in context: A072629 A164292 A337802 * A151763 A324908 A022925 Adjacent sequences:  A257528 A257529 A257530 * A257532 A257533 A257534 KEYWORD nonn AUTHOR Gerald Hillier, Apr 28 2015 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified July 25 02:57 EDT 2021. Contains 346282 sequences. (Running on oeis4.)