OFFSET
1,4
LINKS
Jens Kruse Andersen, Table of n, a(n) for n = 1..10000
EXAMPLE
x, 0 , x , x , x
0 0 0 0 0 0 x x x x
0 0 0 0 0 0 0 0 x
0 0 0 0 0 0 0 0
0 0 0 0 0
prime(n) = 2,3,5,7,11,...
x -> we need respectively 1, 0, 1, 3 and 4 numbers to complete the whole triangle.
MATHEMATICA
Module[{upto=100, tnos}, tnos=Accumulate[Range[Ceiling[(Sqrt[8*Prime[upto]+ 1]- 1)/2]]]; Table[SelectFirst[tnos, #>=Prime[n]&]-Prime[n], {n, upto}]] (* Harvey P. Dale, Jan 15 2015 *)
PROG
(PARI)
a(n)=k=1; while(k*(k+1)/2<prime(n), k++); return(k*(k+1)/2-prime(n))
vector(100, n, a(n)) \\ Derek Orr, Aug 21 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Odimar Fabeny, Aug 20 2014
STATUS
approved