Task

Show the first   30   positive integers which are squares but not cubes of such integers.

Optionally, show also the first   3   positive integers which are both squares and cubes,   and mark them as such.




integer square = 1, squared = 1*1,
        cube   = 1, cubed = 1*1*1, 
        count  = 0
 
while count<30 do
    squared = square*square
    while squared>cubed do cube += 1; cubed = cube*cube*cube end while
    if squared=cubed then
        printf(1,"%d: %d == %d^3\n",{square,squared,cube})
    else
        count += 1
        printf(1,"%d: %d\n",{square,squared})
    end if
    square += 1     
end while
 
printf(1,"\nThe first 15 positive integers that are both a square and a cube: \n")
?sq_power(tagset(15),6)
