smokingfit avatar

Largest Prime Factor | Project Euler 3 | 30 Minutes-ish freeCodeCamp

smokingfit

Published: 08 Jan 2020 › Updated: 08 Jan 2020Largest Prime Factor | Project Euler 3 | 30 Minutes-ish freeCodeCamp

Largest Prime Factor | Project Euler 3 | 30 Minutes-ish freeCodeCamp

So back with some project Euler and retardation that matches a slug traveling to Nevada. This challenge went a bit better, seeing as it took me 20 minutes to learn basic Math from primary and then deciding to cheat and finishing the challenge in 5 minutes or so.

Basically what I am saying is the video is 32 minutes of which only 2 minutes have any form of substance.

There is a way to test for primes using a formula but the higher the number the more false positives you get. You then need to add a list of primes to check against in the test and there are other tests, all of which will take too damn long to figure out.

So for this challenge I had to get the highest Prime factor of a number, this means the biggest prime number that divides into a number and leaving me with 0.

I stole a list of 1000 Prime numbers, reversed it and found the first one that gives me 0 on division. Simple, but probably cheating.








You can find the blog post here:
https://www.freecodecamp.org/news/projecteuler100-coding-challenge-competitive-programming/

And the code site here:
https://www.freecodecamp.org/learn/coding-interview-prep/project-euler/




Posted from Whaleshares

Leave Largest Prime Factor | Project Euler 3 | 30 Minutes-ish freeCodeCamp to:

Written by

Read more #code posts


Best Posts From smokingfit

We have not curated any of smokingfit's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From smokingfit