This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A227727 #28 Dec 25 2023 10:59:44 %S A227727 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, %T A227727 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, %U A227727 3,3,3,4,3,5,5,3,4,37,5,3,14,3,3,4,3,4,13 %N A227727 a(n) is the least r>=3 such that the difference between n and the nearest r-gonal number<=n is an r-gonal number. %C A227727 The n-th r-gonal number is n((n-1)r-2(n-2))/2, such that 3-gonal numbers are triangular numbers, 4-gonal numbers are squares, etc. %H A227727 Peter J. C. Moses, <a href="/A227727/b227727.txt">Table of n, a(n) for n = 0..1999</a> %t A227727 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; prevrGonal[r_,n_]:=nthrGonal[r,Floor[(Sqrt[((8r-16)n+(r-4)^2)]+r-4)/(2r-4)]]; (* previous r-gonal number greater than or equal to n *) Table[NestWhile[#+1&,3,!rGonalQ[#,n-prevrGonal[#,n]]&],{n,0,99}] (* _Peter J. C. Moses_, Aug 03 2013 *) %Y A227727 Cf. A227321. %K A227727 nonn %O A227727 0,1 %A A227727 _Vladimir Shevelev_, Jul 30 2013 %E A227727 More terms from _Peter J. C. Moses_, Jul 30 2013