

A227321


a(n) is the least r>=3 such that the difference between the nearest rgonal number >= n and n is an rgonal number.


3



3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 5, 3, 8, 3, 3, 4, 5, 3, 11, 3, 3, 3, 5, 4, 3, 10, 3, 3, 11, 3, 17, 4, 3, 5, 3, 3, 7, 14, 3, 4, 15, 3, 23, 3, 3, 5, 11, 4, 3, 5, 5, 3, 19, 3, 3, 3, 8, 5, 21, 3, 32, 14, 3, 4, 3, 3, 15, 3, 5, 5, 25, 3, 38, 7, 3, 6, 3, 3, 13, 4, 3
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,1


COMMENTS

The nth rgonal numbers is n((n1)r2(n2))/2, such that 3gonal numbers are triangular numbers, 4gonal numbers are squares, etc.


LINKS



FORMULA

If n is prime, then n == 1 or 2 mod (a(n)2). If n >= 13 is the greater of a pair of twin primes (A006512), then a(n) = (n+3)/2.  Vladimir Shevelev, Aug 07 2013


MATHEMATICA

rGonalQ[r_, 0]:=True; rGonalQ[r_, n_]:=IntegerQ[(Sqrt[((8r16)n+(r4)^2)]+r4)/(2r4)]; nthrGonal[r_, n_]:=(n (r2)(n1))/2+n; nextrGonal[r_, n_]:=nthrGonal[r, Ceiling[(Sqrt[((8r16)n+(r4)^2)]+r4)/(2r4)]]; (* next rgonal number greater than or equal to n *) Table[NestWhile[#+1&, 3, !rGonalQ[#, nextrGonal[#, n]n]&], {n, 0, 99}] (* Peter J. C. Moses, Aug 03 2013 *)


CROSSREFS

Cf. A000217 (r=3), A000290 (r=4), A000326 (r=5), A000384 (r=6), A000566 (r=7), A000567 (r=8), A0011067 (r=9,10), A051682 (r=11), A051624 (r=12), A051865A051876 (r=1324).


KEYWORD

nonn


AUTHOR



EXTENSIONS



STATUS

approved



