OFFSET
1,2
COMMENTS
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..500
EXAMPLE
6943 is in the sequence because 6, 9, 4 and 3 have even and odd parity alternately.
MATHEMATICA
Join[{1, 7}, Select[PolygonalNumber[7, Range[1000]], Union[Abs[Differences[ Boole[ OddQ[ IntegerDigits[ #]]]]]] =={1}&]] (* Harvey P. Dale, Jul 14 2022 *)
PROG
(PARI)
is_alt(n) = m=n; e=n%10; n\=10; while(n>0, f=n%10; if(e%2==f%2, return, e=f; n\=10)); return(m)
select(is_alt, vector(1000, n, (5*n^2-3*n)/2))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Colin Barker, Jan 02 2018
STATUS
approved