OFFSET
1,1
EXAMPLE
9 is the least odd square > 1;
4 is the least even square > 2;
9 is the least odd square > 3.
MATHEMATICA
f[n_] := Block[{s = If[n == 1, Range[3]^2, Range[2 Ceiling@ Sqrt@ n]^2]}, If[EvenQ@ n, SelectFirst[s, EvenQ@ # && # > n &], SelectFirst[s, OddQ@ # && # > n &]]]; Array[f, 120] (* Michael De Vlieger, Mar 25 2015 *)
PROG
(Sage)
A = []
for i in [1..100]:
for y in [1..100]:
x = y**2
if x>i and (x-i)%2==0:
A.append(x)
break
A
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
Tom Edgar and Zak Seidov, Mar 25 2015
STATUS
approved