Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
1

Factoring vs Prime identification

asked 5 years ago

john_alan gravatar image

Hey folks,

I generated two random primes, using random_prime(2^256)

Which gave me:

26743933906960470604491354271488742656120020729367854162490438790852133849203

and

58989902932261902911492570960628926646065206682060380716310751283003413744077

Multiplying them to get a semiprime I get:

1577622065198425994274982187337138762115683359284991921617675178559462773099557341124448864625540436189444788629927033127980383957266963291159527952420631

So maybe this is my miscomprehension, but when I try to run:

factor(on the semiprime) -- it takes a long time, never completing.

When I run

isPrime(on the semiprime) -- it instantly returns false.

If indeed sage generates proper primes (non pseudoprimes) how can isPrime be so efficient. Does verifying that a number ISNT prime, not require identifying a factor? If so, why does factorisation take so long?

Thanks

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

slelievre gravatar image

Yes, checking that a number is not prime can be very easy, without factoring it: you just check that it does not satisfy some condition that all primes satisfy.

For example, if n is a prime, then for any integer a, we have an is congruent to a modulo n.

Another way to say that is that if n is an integer, and if there is any integer a such that an is not congruent to a modulo n, then n is not prime. Finding such an a can be very cheap but it would not give a way to factor n.

See the notion of probable prime and pseudo-prime.

Preview: (hide)
link

Comments

thank you sir!

john_alan gravatar imagejohn_alan ( 5 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 5 years ago

Seen: 476 times

Last updated: Oct 07 '19