OFFSET
1,2
COMMENTS
Eventually all primes p appear since (p +/-1) times 1(1+1)/2 equals (p +/- 1).
If we asked for the least number k then k always equals 1 since all primes p appear since (p +/-1) times 1(1+1)/2 equals (p +/- 1).
The k's for the corresponding j's are: round(sqrt(2p/j)).
First occurrence of i is A125770: 1, 2, 7, 9, 34, 31, 54, 15, 16, 26, 148, 68, 398, 62, 193, 25, 27, 140, 550, 397, 107, 113, ...,.
EXAMPLE
a(1) = 1 because 1*1+1 = 2 which is the first prime,
a(2) = 2 because 2*1+1 = 3 which is the second prime,
a(3) = 4 because 1*6-1 = 5 which is the third prime,
a(8) = 3 because 2*10-1 = 19 which is the eighth prime, ...
MATHEMATICA
triQ[n_] := IntegerQ@ Sqrt[8n + 1]; f[n_] := Block[{j = 1, p = Prime@n}, While[ !triQ[(p - 1)/j] && !triQ[(p + 1)/j], j++ ]; j]; Array[f, 92]
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonathan Vos Post & Robert G. Wilson v, Dec 01 2006
STATUS
approved