Use up to to one thousand (1,000) rather than up to one (1.000) as otherwise it would be a pretty short list...
say ({$++²}…^*>Ⅿ).grep: (*+1).is-prime
Output:
(1 4 16 36 100 196 256 400 576 676)
Although, technically, there is absolutely nothing in the task directions specifying that n needs to be the square of an integer. So, more accurately...
put (^Ⅿ).grep(*.is-prime).map(*-1).batch(20)».fmt("%3d").join: "\n"