OFFSET
1,2
LINKS
Sean A. Irvine, Table of n, a(n) for n = 1..53 (terms 1..33 from Giovanni Resta)
EXAMPLE
a(4) = 1296 as 1, 2, 9 and 6 have odd and even parity alternately.
MATHEMATICA
altQ[n_] := n < 10 || Union[ Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; a[n_] := Block[{r = Ceiling@ Sqrt@ FromDigits[ Mod[Range@ n, 2]]}, While[! altQ[r^2], r++]; r^2]; Array[a, 16] (* Giovanni Resta, Aug 17 2018 *)
PROG
(Python)
from math import isqrt
from itertools import count, islice
def allalt(s):
es, os, e, o = set(s[::2]), set(s[1::2]), set("02468"), set("13579")
return (es <= o and os <= e) or (es <= e and os <= o)
def a(n):
r = isqrt(int(("10"*n)[:n]))
while len(s:=str(r*r)) < n or not allalt(s): r += 1
return int(s)
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Mar 21 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Mar 19 2002
EXTENSIONS
More terms from Sascha Kurz, Mar 23 2002
a(14)-a(20) from Giovanni Resta, Aug 17 2018
STATUS
approved