A139557 a(1)=2. For n>=2, a(n) = smallest integer > a(n-1) that is not coprime to n but is coprime to (n+1).
2, 4, 9, 12, 25, 26, 35, 38, 39, 40, 55, 56, 65, 68, 69, 70, 85, 86, 133, 134, 135, 136, 161, 162, 165, 166, 171, 172, 203, 204, 217, 218, 219, 221, 235, 236, 259, 262, 267, 268, 451, 452, 559, 562, 565, 566, 611, 612, 623, 625, 627, 628, 689, 692, 695, 698, 699
Offset: 1
Keywords
Crossrefs
Cf. A139558.
Programs
-
Maple
A139557 := proc(n) option remember ; local a,i; if n = 1 then RETURN(2) ; fi ; for a from A139557(n-1)+1 do if gcd(a,n+1) = 1 and gcd(a,n) <> 1 then RETURN(a) ; fi ; od: a ; end: seq(A139557(n),n=1..100) ; # R. J. Mathar, May 20 2008
-
Mathematica
f[1] = 2; f[n_] := f[n] = Block[{k = f[n - 1] + 1}, While[ GCD[n, k] == 1 || GCD[n + 1, k] > 1, k++ ]; k]; Array[f, 57] (* Robert G. Wilson v *)
Extensions
More terms from R. J. Mathar and Robert G. Wilson v, May 20 2008
Comments