OFFSET
1,2
COMMENTS
Old definition was: Odd integers n such that 2^(n-1) == 4^(n-1) == 8^(n-1) == ... == k^(n-1) (mod n), where k = A062383(n). Dividing 2^(n-1) == 4^(n-1) (mod n) by 2^(n-1), we get 1 == 2^(n-1) (mod n), implying the current definition. - Max Alekseyev, Sep 22 2016
The union of {1}, the odd primes, and the Fermat pseudoprimes, i.e., {1} U A065091 U A001567. Also, the union of A006005 and A001567 (conjectured by Alois P. Heinz, Dec 10 2010). - Max Alekseyev, Sep 22 2016
These numbers were called "fermatians" by Shanks (1962). - Amiram Eldar, Apr 21 2024
REFERENCES
Daniel Shanks, Solved and Unsolved Problems in Number Theory, Spartan Books, Washington D.C., 1962.
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..10000
EXAMPLE
5 is in the sequence because 2^(5-1) == 4^(5-1) == 8^(5-1) == 1 (mod 5).
MATHEMATICA
m = 1; Join[Select[Range[m], Divisible[2^(# - 1) - m, #] &],
Select[Range[m + 1, 10^3], PowerMod[2, # - 1, #] == m &]] (* Robert Price, Oct 12 2018 *)
PROG
(PARI) isok(n) = Mod(2, n)^(n-1) == 1; \\ Michel Marcus, Sep 23 2016
(Python)
from itertools import count, islice
def A176997_gen(startvalue=1): # generator of terms >= startvalue
if startvalue <= 1:
yield 1
k = 1<<(s:=max(startvalue, 1))-1
for n in count(s):
if k % n == 1:
yield n
k <<= 1
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Dec 08 2010
EXTENSIONS
Edited by Max Alekseyev, Sep 22 2016
STATUS
approved