Art of Problem Solving: Testing if a Number is Prime

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

There's a trick for checking 7, 11, and 13 all at once. It works on the fact that their product is 1001.

If 281 is/isn't divisible by any of those three, then the same is true of 281 times any number that isn't a multiple of any of the three.
Such as any power of 10, because 10 = 2·5, which means that it, and any of its powers, aren't divisible by any prime other than 2 and 5.

So testing 281 for divisibility by 7, 11, and 13 can be done by testing
281·100 = 28100.

But since 7·11·13 = 1001, any multiple of 1001 is also divisible by all three of them.
Such as 28·1001 = 28028.

So subtract:
28100 – 28028 = 100 – 28 = 72

But 72 has only 2 and 3 as prime divisors: 72 = 8·9 = 2³·3²
So 72 isn't divisible by 7, 11, or 13; so neither is 28100; and so neither is 281.

ffggddss
Автор

A general little tricky to test divisibility by a number that isn't a multiple of 2 or 5 is to add or subtract a multiple of the divisor to make an easier number to check.

For example, to check if 281 is divisible by 13, you could add 39 to 281, which is 320. Since 13 and 10 are comprimes, that means that you only have to check if 32 is divisible by 13.

For divisiblility by 11, just substract 11 and you get 270. Now check if 27 is divisible by 11.

EnteiFire
Автор

Love the energy. Just love it. Not coming off as patronising; just simply passionate.

darkvader
Автор

Wow. Steve from Blue's Clues really knows lot about prime numbers. I'm so happy that he put his college education to good use. Good for you Steve, Blue would be so proud of you.

juliewylie
Автор

That was so funny and informative. Thanks so much. You are the cause of me getting so piped up for contest math!

abhichakladar
Автор

"These aren't the divisors you're looking for."
"These aren't the divisors we're looking for."
"He can go about his business."
"You can go about your business."

pianoplayer
Автор

Define "slick." If by "slick, " you mean an elementary way that's easy for you and me to understand, then I'm going to bet no.

ArtofProblemSolving
Автор

If you wanna know if 281's prime, just skip to any time between 6:59 and 7:57.

jangwoo
Автор

In truth, you could have stopped after 13, because the *square* of the next prime, 17² = 289, is greater than 281.
And once you reject 13, you've already eliminated all divisors through 16.

ffggddss
Автор

The CROSS contains everything in Math, yet it takes perception to "see it".

jonathanray
Автор

There is a method for testing for 11 without doing the division. add every other digit subtract the sum of the remaining digit and if the result is 0 or divisible by 11 it's divisible by 11

wristdisabledwriter
Автор

Absolutely the best subject matter ever created I love prime numbers and thank you for the helpful new twist because it does make them easier to sell but I do them all in my head it’s interesting and fun sometimes taxing; big thank you for this lovely explanation today!

michaelparker
Автор

lol "Those aren't the divisors you're looking for"

homeedders
Автор

Factoring numbers is a hard problem. But we do have algorithms that with high probability will tell you if a number is prime or not.  That is to say, the algorithm will tell you if a number if prime or not (with high [probability) but it will not tell you the factors if it is not prime.

jacktade
Автор

Interesting approach; to go until the quotient is less than the divisor, but I would also say "less than or equal to" because if the number being tested were 289 instead, and you didn't recognize it as a perfect square, you would stop when the quotient equals the divisor.

punstress
Автор

Thanks. I bookmarked this video. Does this algorithm have a formal name? If I ever knew it, I forgot it.

I once wrote a C program to do this in the background on the company's dime. I don't think I ever found a way to find primes larger than the largest integer representable on the machine though. There must be some way to do that by chaining words together.

JimCoder
Автор

The algorithm is named simply "trial division"?

JimCoder
Автор

While I don't have a faster way to test if a number is prime, I do have a faster way to find out what number you have to stop at if you don't find any prime divisors. You take the number you're testing and find out its perfect square range, aka find out the greatest perfect square that's less than the number you're testing and find out the least perfect square that's greater than the number you're testing. Then, take the square roots of those numbers. If the greatest prime number that's less than the smaller square root isn't a divisor of the number you're testing, then the number you're testing is prime.
For example, if I were to test 467, the perfect square range is 441 to 484. The square root of 441 is 21 and the square root of 484 is 22. The greatest prime less than 21 is 19, so if 19 isn't a divisor of 467, then 467 is prime.

benrythefox
Автор

A number is prime if it can be written in the form 6n+1 or 6n-1. 282 is a multiple of 6 by 47.

mukuldhingra
Автор

How'd he get the 6 as a remainder while dividning by 7

wolfmccall
welcome to shbcf.ru