OFFSET
0
COMMENTS
Pentagonal numbers are of the form (3*n^2-n)/2.
FORMULA
For n > 0, a(n) = floor(sqrt(2*n/3+1/36)+1/6)-floor(sqrt(2*(n-1)/3+1/36)+1/6).
MATHEMATICA
Join[{1}, Table[If[IntegerQ[(1+Sqrt[1+24n])/6], 1, 0], {n, 100}]] (* Harvey P. Dale, Feb 25 2018 *)
Module[{nn=20, n5}, n5=PolygonalNumber[5, Range[0, nn]]; Table[If[MemberQ[ n5, n], 1, 0], {n, 0, n5[[-1]]}]] (* Harvey P. Dale, Dec 30 2021 *)
PROG
(PARI) a(n) = ispolygonal(n, 5); \\ Michel Marcus, Aug 04 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Mikael Aaltonen, Mar 08 2015
STATUS
approved