OFFSET
2,1
LINKS
Robert Israel, Table of n, a(n) for n = 2..10000
FORMULA
From Rémy Sigrist, Feb 04 2018: (Start)
a(p) = 3 * p for any odd prime p.
a(2*k + 1) = a(2*k) + 1 for any k > 0.
a(n) = n + 2*A172170(n + 1) for any n > 1.
(End)
EXAMPLE
8 is the least k>2 such that gcd(8,2)>1 and gcd(9,3)>1. So a(2)=8.
15 is the least k>9 such that gcd(15,9)>1 and gcd(16,10)>1. Therefore a(9)=15.
MAPLE
f:= proc(n) local k;
for k from n+1 do if igcd(k, n)>1 and igcd(k+1, n+1)>1 then return k fi od
end proc:
map(f, [$2..100]); # Robert Israel, Mar 08 2018
MATHEMATICA
Array[Block[{k = # + 1}, While[Or[CoprimeQ[#, k], CoprimeQ[# + 1, k + 1]], k++]; k] &, 62, 2] (* Michael De Vlieger, Feb 03 2018 *)
PROG
(PARI) a(n) = for (k=n+1, oo, if (gcd(n, k)>1 && gcd(n+1, k+1)>1, return (k))) \\ Rémy Sigrist, Feb 04 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Feb 03 2018
STATUS
approved