OFFSET
1,1
COMMENTS
a(10^k): 4, 77, 1717, 46871, 1027767, 34696937, 1068983293, ... and a(2^k): 4, 9, 15, 39, 119, 345, 685, 2415, 5911, 18855, 47995, 124455, 290615, 794529, 2571825, 6910425, 18153749, 50986623, 147584275, 431488203, 1146090309, ..., . - Robert G. Wilson v, May 20 2008
Least term k such that there are just n consecutive terms: 4, 9, 91, 199068, 16621, 14052655, 17301, 6156769, 66781, 330484338, 376051, ???, 273222587, ???, 83335435, ..., . - Robert G. Wilson v, May 20 2008
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Apr 27 2008
EXTENSIONS
More terms from R. J. Mathar and Robert G. Wilson v, May 20 2008
STATUS
approved