Perfect square word problem