login
A299112
Record values in A243145.
1
1, 2, 6, 12, 16, 30, 42, 54, 66, 78, 105, 120, 156, 330, 525, 546, 831, 1071, 1251, 1386, 1875, 1890, 2136, 2241, 2331, 2541, 2565, 2736, 2871, 3165, 3606, 3885, 4710, 5106, 5220, 5505, 6375, 6390, 6426, 6615, 6786, 8310, 8571, 9066, 10050, 10176, 10221, 10611, 11865, 11955, 12096
OFFSET
1,2
MAPLE
f:= proc(n) local k;
for k from (n mod 2)+1 by 2 do
if isprime(n+k) and isprime(n+k^2) then return k fi
od
end proc:
f(1):= 1:
vmax:= 0: recvals:= NULL:
for n from 1 to 10^7 do
v:= f(n);
if v > vmax then
vmax:= v; recvals:= recvals, v;
fi
od:
recvals;
MATHEMATICA
f[n_] := Module[{k}, For[k = Mod[n, 2]+1, True, k += 2, If[PrimeQ[n + k] && PrimeQ[n + k^2], Return [k]]]]; f[1] = 1;
vmax = 0;
Reap[For[n = 1, n <= 10^6, n++, v = f[n]; If[v > vmax, vmax = v; Print["n = ", n, " v = ", v]; Sow[v]]]][[2, 1]] (* Jean-François Alcover, Oct 16 2020, after Maple *)
CROSSREFS
Sequence in context: A084790 A130237 A053457 * A154030 A055560 A237719
KEYWORD
nonn
AUTHOR
Robert Israel, Feb 02 2018
EXTENSIONS
a(34)-a(51) from Chai Wah Wu, Sep 10 2019
STATUS
approved