A139558 a(1)=4. For n>=2, a(n) = smallest integer > a(n-1) that is not coprime to (n+1) but is coprime to n.
4, 9, 10, 15, 16, 35, 36, 39, 40, 77, 78, 91, 92, 93, 94, 119, 120, 133, 134, 141, 142, 161, 162, 175, 176, 177, 178, 261, 262, 341, 342, 345, 346, 355, 356, 407, 408, 411, 412, 451, 452, 473, 474, 475, 476, 517, 518, 539, 540, 543, 548, 583, 584, 595, 596, 597
Offset: 1
Keywords
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Maple
A139558 := proc(n) option remember ; local a,i; if n = 1 then RETURN(4) ; fi ; for a from A139558(n-1)+1 do if gcd(a,n) = 1 and gcd(a,n+1) <> 1 then RETURN(a) ; fi ; od: a ; end: seq(A139558(n),n=1..100) ; # R. J. Mathar, May 20 2008
-
Mathematica
f[1] = 4; f[n_] := f[n] = Block[{k = f[n - 1] + 1}, While[ GCD[n + 1, k] == 1 || GCD[n, k] > 1, k++ ]; k]; Array[f, 56] (* Robert G. Wilson v, May 20 2008 *) FoldList[SelectFirst[Range[#1 + 1, #1 + 120], Function[k, And[CoprimeQ[k, #2], ! CoprimeQ[k, #2 + 1]]]] &, 4, Range[2, 56]] (* Michael De Vlieger, Oct 22 2017 *)
Extensions
More terms from R. J. Mathar and Robert G. Wilson v, May 20 2008
Comments