OFFSET
1,1
FORMULA
EXAMPLE
a(1)=7 since P(7)=70 is the least pentagonal number which can be written as sum of two other pentagonal numbers, P(7)=P(5)+P(5).
PROG
(PARI) P(n)=n*(3*n-1)>>1 /* a.k.a. A000326 */
isPent(t)=P(sqrtint(t<<1\3)+1)==t
for(i=1, 999, for(j=1, (i+1)\sqrt(2), isPent(P(i)-P(j))&print1(i", ") || next(2)))
/* The following are much faster, at the cost of implementing sum2sqr(), cf. A133388. */
A136116next(i)=i=6*i-1; until(0, for(j=2, #t=sum2sqr((i+=6)^2+1), t[j]%6==[5, 5] && break(2))); i\6+1
A136116vect(n, i=0)=vector(n, j, i=A136116next(i))
A136116(n, i=0)=until(!n--, i=A136116next(i)); i \\ M. F. Hasler, Dec 25 2007
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Dec 15 2007; corrected Dec 25 2007
STATUS
approved