{SOLVED} Prime Pathing [HELP!] Language: Javascript or Python (either is fine)

Hey guys! I am currently new, 'cause I created an account a few minutes ago, and anyway, I need help! I wanted to start from the beginning. Just so you know, I am just a kid that is 8 years old. Here is the code:

# 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.


Ok, and here is my equipment:

Please help! Oh yeah, I am NOT a subscriber, and don’t tell me to buy it because I am just a KID.
I am not that good at coding, but I want to learn! SO, Please help!

I also prefer Javascript but either language is fine for me. And by either, I mean Javascript or Python.

Oh and I prefer to reply withing 2 hours

We can’t give answers on the forum

Ok, can you help and give me clues?

Sorry I haven’t done this level before and welcome to the forum!

ok, shall i give you a tour? I mean I want to give you a tour of the level.

Here is the direct link to the level! Prime Pathing in Kelvintaph Glacier

@Deadpool198? @AnSeDra? help!

what about @xython? please?

Oh yeah! The topic will lock once 12 hours have happened after the last reply

It won’t lock after twelve hours it will only do that if you marked it solved

But, it says so! Don’t you see it?

Nope I don’t see it 20 chars

Welcome. I guess I’m a little confused. When you say you just created an account a few minutes ago, is that for CodeCombat or the Forum? That level is an advanced level and you have some good gear.

One way do complete this level is creating a huge list of all the Prime numbers to check against. I didn’t feel like trying to figure out an algorithm to find Prime numbers. Once you know what traps are duds, command your hero and friends to walk through them.

On a side note, is it alright if I remove the {SOLVED} from the title @The_Master_Coder? It’s clear this problem isn’t solved.
And, as Eric said, topics only close within 12 hours if it’s solved with the solution button that you can get by clicking on the three dots next to a post. Please only use this if the topic actually is solved.
Thank you,
Danny

Hi The_Master_Coder,

Welcome to the forum, and well done for getting as far as you have (particularly if you’re 8 :grin:). You should be able to solve this with good code and the equipment you have!

You want to write a function to check whether a number is prime. Two bits of information that will help:

  • You want to check whether your big number leaves a remainder when you divide it by a smaller number - if it divides exactly then the big number isn’t a prime. How do you check for a remainder?

  • You need to check all the small numbers from 2 upwards towards your big number, so you’ll need a for loop. However a hint - you only need to check up to the square root of the big number. So if you were trying to find out if 119 was prime, you’d only need to check the small numbers up to 10 (the square root of 119 is 10.9).

Have a go at writing some code, and post again if you’re stuck.

Jenny

1 Like

Actually @Deadpool198, I was trying to say that I solved it yesterday, but it said that I reached the limit of replying for one day and it muted me for the day. Sorry about that! but I am done with it.

I need help on something else: Sarven Brawl 4 help! {Python}

nevermind, I finished!