login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A227321
a(n) is the least r>=3 such that the difference between the nearest r-gonal number >= n and n is an r-gonal 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
OFFSET
0,1
COMMENTS
The n-th r-gonal numbers is n((n-1)r-2(n-2))/2, such that 3-gonal numbers are triangular numbers, 4-gonal 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[((8r-16)n+(r-4)^2)]+r-4)/(2r-4)]; nthrGonal[r_, n_]:=(n (r-2)(n-1))/2+n; nextrGonal[r_, n_]:=nthrGonal[r, Ceiling[(Sqrt[((8r-16)n+(r-4)^2)]+r-4)/(2r-4)]]; (* next r-gonal 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), A001106-7 (r=9,10), A051682 (r=11), A051624 (r=12), A051865-A051876 (r=13-24).
Sequence in context: A048181 A091799 A276863 * A309555 A262994 A179847
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Jul 30 2013
EXTENSIONS
More terms from Peter J. C. Moses, Jul 30 2013
STATUS
approved