|
|
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
|
|
|
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
|
|
|
CROSSREFS
|
Characteristic function for A176997 (without its initial 1).
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|