%I #20 Jun 04 2020 06:37:01
%S 2,17,53,163,487,1459,4373,13121,39367,472391,1062881,1062881,
%T 19131877,19131877,57395627,86093443,258280327,3874204891,6973568801,
%U 6973568801,188286357653,188286357653,188286357653,4518872583697,15251194969973
%N Smallest prime p such that 3^n divides p^2 - 1.
%C Smallest prime of the form k*3^n-1 or k*3^n+1. - _Robert Israel_, Oct 27 2019
%H Robert Israel, <a href="/A125609/b125609.txt">Table of n, a(n) for n = 1..2088</a>
%H Martin Fuller, <a href="/A125609/a125609.gp.txt">PARI program</a>
%H W. Keller and J. Richstein, <a href="https://web.archive.org/web/20140809030451/http://www1.uni-hamburg.de/RRZ/W.Keller/FermatQuotient.html">Fermat quotients that are divisible by p</a>.
%p f:= proc(n) local k;
%p for k from 1 do
%p if isprime(k*3^n-1) then return k*3^n-1
%p elif isprime(k*3^n+1) then return k*3^n+1
%p fi
%p od
%p end proc:
%p map(f, [$1..30]); # _Robert Israel_, Oct 27 2019
%t f[n_] := Module[{k}, For[k = 1, True, k++, If[PrimeQ[k*3^n-1], Return[k*3^n-1], If[PrimeQ[k*3^n+1], Return[k*3^n+1]]]]];
%t Array[f, 30] (* _Jean-François Alcover_, Jun 04 2020, after Maple *)
%o For PARI program see link.
%Y Cf. A125609 = Smallest prime p such that 3^n divides p^2 - 1. Cf. A125610 = Smallest prime p such that 5^n divides p^4 - 1. Cf. A125611 = Smallest prime p such that 7^n divides p^6 - 1. Cf. A125612 = Smallest prime p such that 11^n divides p^10 - 1. Cf. A125632 = Smallest prime p such that 13^n divides p^12 - 1. Cf. A125633 = Smallest prime p such that 17^n divides p^16 - 1. Cf. A125634 = Smallest prime p such that 19^n divides p^18 - 1. Cf. A125635 = Smallest prime p such that 257^n divides p^256 - 1.
%K nonn
%O 1,1
%A _Alexander Adamchuk_, Nov 28 2006
%E Corrected and extended by _Ryan Propper_, Jan 01 2007
%E More terms from _Martin Fuller_, Jan 11 2007