

A227727


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


1



3, 3, 3, 3, 3, 4, 3, 3, 4, 3, 3, 3, 5, 3, 7, 3, 3, 4, 3, 7, 4, 3, 3, 5, 3, 4, 4, 3, 3, 3, 11, 3, 16, 9, 3, 5, 3, 3, 19, 3, 4, 7, 3, 6, 22, 3, 3, 5, 3, 4, 4, 3, 5, 4, 19, 3, 3, 15, 3, 11, 6, 3, 7, 5, 4, 3, 3, 3, 4, 3, 5, 5, 3, 4, 37, 5, 3, 14, 3, 3, 4, 3, 4, 13
(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

Peter J. C. Moses, Table of n, a(n) for n = 0..1999


MATHEMATICA

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


CROSSREFS

Cf. A227321.
Sequence in context: A209291 A332875 A176873 * A050499 A304431 A147752
Adjacent sequences: A227724 A227725 A227726 * A227728 A227729 A227730


KEYWORD

nonn


AUTHOR

Vladimir Shevelev, Jul 30 2013


EXTENSIONS

More terms from Peter J. C. Moses, Jul 30 2013


STATUS

approved



