|
|
A243111
|
|
Difference between the smallest triangular number >= n-th prime and the n-th prime.
|
|
1
|
|
|
1, 0, 1, 3, 4, 2, 4, 2, 5, 7, 5, 8, 4, 2, 8, 2, 7, 5, 11, 7, 5, 12, 8, 2, 8, 4, 2, 13, 11, 7, 9, 5, 16, 14, 4, 2, 14, 8, 4, 17, 11, 9, 19, 17, 13, 11, 20, 8, 4, 2, 20, 14, 12, 2, 19, 13, 7, 5, 23, 19, 17, 7, 18, 14, 12, 8, 20, 14, 4, 2, 25, 19, 11, 5, 27, 23, 17, 9, 5, 26, 16, 14, 4, 2, 26
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
LINKS
|
|
|
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
|
|
|
STATUS
|
approved
|
|
|
|