a(2)=1 since 29 is a prime which is four more than a square and floor[29/24]=1

MATHEMATICA

Join[{0}, Floor[#/24]&/@Select[Prime[Range[10000]], #-Floor[Sqrt[#]]^2 == 4&]] (* Harvey P. Dale, Oct 25 2011 *)

CROSSREFS

a(n) is contained in A001840. A005473(n)=24*a(n)+m, where m=13 if a(n) is three times a triangular number (and n>0) i.e. in A045943 and m=5 if A056904(n) is not three times a triangular number (or n=0) i.e. in A001318.