all numbers with perfect squares code example
Example: all perfect squares up to n
def perfect_squares(minimum, maximum) :
# get first number
number = ceil(sqrt(minimum));
# get fisrt number's square
n2 = number * number;
# get next
number = (number * 2) + 1;
while ((n2 >= minimum and n2 <= maximum)) :
# print perfect square
print(n2, end= " ");
# find next perfect square
n2 = n2 + number;
# next odd number to be added
number += 2;