OFFSET
1,2
LINKS
Pierre CAMI, Table of n, a(n) for n = 1..2000
EXAMPLE
For n = 4, 3^4 + 3^4 - 1 = 161 = 7*23, 3^4 + 3^3 - 1 = 107 so a(4) = 3.
For n = 154, for k = 0, 1, 2, 3, ..., 154, the numbers 3^154 + 3^k - 1 are respectively divisible by 3, 5531, 73, 5, 7, 19001, 6553, 5, 239, 3541, 7, 5, 33247, 71, 19, 5, 7, 29, 1973, 5, 436467739, 71161, 7, 5, 4283, 37, 73, 5, 7, 11177, 13721, 5, 19, 29207, 7, 5, 64849, 4001, 73, 5, 7, 31, 227009113, 5, 139, 29, 7, 5, 71, 107102231, 19, 5, 7, 10765021647412056860623883, 521, 5, 241, 1448445976112887644909473, 7, 5, 5657, 37, 73, 5, 7, 110661029, 65963, 5, 19, 20411, 7, 5, 331, 29, 73, 5, 7, 7671791, 269, 5, 563, 211, 7, 5, 6553, 113, 19, 5, 7, 425679689, 1301, 5, 334244063, 53, 7, 5, 15254167, 37, 73, 5, 7, 29, 3391, 5, 19, 7727, 7, 5, 4799, 2269, 73, 5, 7, 1822597729, 47, 5, 242496218184092003, 38971, 7, 5, 9994245487379630507640393493999, 9104413, 19, 5, 7, 3581, 1039, 5, 181, 29, 7, 5, 2472681219552827727900539, 37, 73, 5, 7, 47, 99986141, 5, 19, 1237, 7, 5, 55817, 53, 73, 5, 7, 1033, 9187, 5, 199, 71, 7. So a(154) = 0.
PROG
(PARI) a(n) = my(k=n); while (!isprime(3^n + 3^k - 1), k--; if (k==0, return (0))); k; \\ Michel Marcus, Sep 16 2019
(Magma) sol:=[]; for n in [1..70] do k:=n; while not IsPrime(3^n+3^k-1) and k gt 0 do k:=k-1; end while; if k ge 0 then Append(~sol, k); else Append(~sol, 0); end if; end for; sol; // Marius A. Burtea, Sep 16 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Pierre CAMI, Jan 29 2011
STATUS
approved