OFFSET
1,1
COMMENTS
Equivalently, a(n) is the smallest composite number k such that 2^(k-1) == 1 (mod k) and gpf(p-1) = prime(n) for all prime factors p of k.
LINKS
Daniel Suteu, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Poulet Number
EXAMPLE
a(1) = 4369 = (2*2*2*2 + 1)(2*2*2*2*2*2*2*2 + 1).
a(2) = 1387 = (2*3*3 + 1)(2*2*2*3*3 + 1).
a(3) = 341 = (2*5 + 1)(2*3*5 + 1).
a(4) = 3277 = (2*2*7 + 1)(2*2*2*2*7 + 1).
a(5) = 2047 = (2*11 + 1)(2*2*2*11 + 1).
MATHEMATICA
pspQ[n_] := CompositeQ[n] && PowerMod[2, (n - 1), n] == 1; gpf[n_] := FactorInteger[n][[-1, 1]]; g[n_] := If[Length[(u = Union[gpf /@ (FactorInteger[n][[;; , 1]] - 1)])] == 1, u[[1]], 1]; m = 10; c = 0; k = 0; v = Table[0, {m}]; While[c < m, k++ If[! pspQ[k], Continue[]]; If[(p = g[k]) > 1, i = PrimePi[p]; If[i <= m && v[[i]] == 0, c++; v[[i]] = k]]]; v (* Amiram Eldar, Oct 08 2019 *)
PROG
(Perl) use ntheory ":all"; sub a { my $p = nth_prime(shift); for(my $k = 4; ; ++$k) { return $k if (is_pseudoprime($k, 2) and !is_prime($k) and vecall { (factor($_-1))[-1] == $p } factor($k)) } }
for my $n (1..25) { print "a($n) = ", a($n), "\n" }
CROSSREFS
KEYWORD
nonn
AUTHOR
Daniel Suteu, Sep 25 2019
STATUS
approved