[go: up one dir, main page]

login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
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
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).
Sequence in context: A072629 A164292 A337802 * A151763 A353558 A353638
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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 29 17:51 EDT 2024. Contains 375518 sequences. (Running on oeis4.)