OFFSET
0,3
LINKS
Robert Israel, Table of n, a(n) for n = 0..10001
EXAMPLE
196981 is in the sequence because it is a heptagonal number and the sum of its digits (34) is also a heptagonal number.
MAPLE
N:= 10000: # to search the first N heptagonal numbers
sd:= n -> convert(convert(n, base, 10), `+`):
hept:= x -> type((3+sqrt(9+40*x))/10, integer) or x = 0:
select(hept @ sd, [seq(n*(5*n-3)/2, n=0..N)]);
# Robert Israel, Feb 14 2013
PROG
(PARI) isok(n) = ispolygonal(n, 7) && ispolygonal(sumdigits(n), 7);
for(n=0, 1e5, if(isok(n), print1(n, ", "))) \\ Altug Alkan, Dec 08 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Luc Stevens (lms022(AT)yahoo.com), Apr 11 2006
EXTENSIONS
a(0)=0 inserted by Georg Fischer, Mar 27 2024
STATUS
approved