# Help! Prime Pathing

``````# Get all your troops to the end of the path by passing over the mines.
# You can locate duds by finding the mines that have a value that is a prime number.
# Check the guide for clarification.

def prime():
for n in Math.ceil(Math.sqrt(2)):
if n % 2 == 0:
return False
else:
return True
for n in Math.ceil(Math.sqrt(3)):
if n % 3 == 0:
return False
else:
return True
for n in Math.ceil(Math.sqrt(7)):
if n % 7 == 0:
return False
else:
return True
if n == True:
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", n)

while True:
prime()

``````

Lydia

take a picture of the whole screen first and then show us where the error is coming from

Yes as @darklord999 said I can’t tell where the error is coming from. Send a full screenshot instead of a cropped one   Its coming from this line
Lydia

I haven’t dont this in a while but it may be because you haven’t defined `Math.ceil`

That is included in the hints so I don’t think I’ll need to define it

Lydia

I’m honestly not really sure. @Chaboi_3000 probably knows

Hello?
Lydia
20 chaa

Like I said I don’t really know but someone else will like @Deadpool198 or @Bryukh

This line can’t work, you are trying to iterate a number. Maybe you wanted to something like
`for n in range(Math.ceil(Math.sqrt(2))):` ?

3 Likes
``````# Get all your troops to the end of the path by passing over the mines.
# You can locate duds by finding the mines that have a value that is a prime number.
# Check the guide for clarification.

def prime():
for n in range(Math.ceil(Math.sqrt(2))):
if n % 2 == 0:
return False
else:
return True
for n in range(Math.ceil(Math.sqrt(2))):
if n % 3 == 0:
return False
else:
return True
for n in range(Math.ceil(Math.sqrt(2))):
if n % 7 == 0:
return False
else:
return True
if n == True:
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", n)

while True:
prime()

``````

Now there is no error but my hero just stands there and does nothing and eventually ran out of time.
Lydia

There are no commands to make your hero to move. Also I’m not sure what your function `prime’ does. It should take an argument and return True or False if the number is a prime one or not. Still it just a small part of the solution, because you need to do a lot there.

This level is an advanced one.

1 Like