OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..500
FORMULA
A001222(n*a(n)+1) = n.
EXAMPLE
a(3) = 17 because 17 is prime and 3 * 17 + 1 = 52 = 2^2 * 13 is the product of 3 primes, and no smaller prime works.
MAPLE
f:= proc(n)
uses priqueue;
local Q, t, q, i;
initialize(Q);
q:= 2;
while n mod q = 0 do q:= nextprime(q) od:
insert([-q^n, q, n], Q);
do
t:= extract(Q);
if -t[1]-1 mod n = 0 and isprime((-t[1]-1)/n) then return (-t[1]-1)/n fi;
q:= nextprime(t[2]);
while n mod q = 0 do q:= nextprime(q) od;
for i from 1 to t[3] do
insert([t[1]*(q/t[2])^i, q, i], Q);
od
od;
end proc:
map(f, [$1..40]);
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Zak Seidov and Robert Israel, Nov 26 2023
STATUS
approved