Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming gpu hard drive hardware hdmi internet laptop malware memory monitor motherboard netgear network printer problem ram registry router security slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Solved: Algorithm for factoring 32-bit integers

Reply  
Thread Tools
avisitor's Avatar
Computer Specs
Senior Member with 1,712 posts.
 
Join Date: Jul 2008
Location: Chicago, IL
Experience: Advanced
29-Nov-2008, 09:29 AM #1
Solved: Algorithm for factoring 32-bit integers
Does anyone happen to know of an algorithm for calculating the prime factors of a 32bit integer. I tried Googling, but I didn't really come up with anything. I see there's an FFT algorithm for this, but is that just for matrices? I know I can just repeatedly divide in, but that's terribly slow and inefficient when you've got tens of thousands of integers you want to calculate the factors of.

Despite how this sounds, it's not a homework problem, rather, it's just a project I'm working on. Thanks in advance.
__________________
Austin

Please refresh, I edit my posts often.
etaf's Avatar
Computer Specs
Moderator with 34,408 posts.
 
Join Date: Oct 2003
Location: Surrey, UK
Experience: Intermediate
29-Nov-2008, 10:08 AM #2
have a read here - how to set up excel
http://people.revoledu.com/kardi/tut...rimeFactor.htm
avisitor's Avatar
Computer Specs
Senior Member with 1,712 posts.
 
Join Date: Jul 2008
Location: Chicago, IL
Experience: Advanced
29-Nov-2008, 10:23 AM #3
Right, that's the divide method. Is there any other way besides that?
IMM's Avatar
IMM IMM is offline IMM is authorized to help remove malware.
Malware Removal Specialist with 3,260 posts.
 
Join Date: Feb 2002
29-Nov-2008, 11:34 PM #4
You could look at this http://en.wikipedia.org/wiki/Lenstra..._factorization and the external link at the bottom hxxp://alpertron.com.ar/ECM.htm which offers java source -- but with your max of about 2^31, then the prime factors are less than square root of 2^31 (about 2^16) and you may just want to use a table of primes method?
avisitor's Avatar
Computer Specs
Senior Member with 1,712 posts.
 
Join Date: Jul 2008
Location: Chicago, IL
Experience: Advanced
30-Nov-2008, 09:57 AM #5
Yeah, the table of primes is how I ended up implementing it. Thanks for the suggestions.
lotuseclat79's Avatar
Distinguished Member with 21,345 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
07-Dec-2008, 09:13 AM #6
Take a look at Sieve of Eratosthenes.

-- Tom
BobFoster's Avatar
Junior Member with 18 posts.
 
Join Date: Dec 2008
Experience: Advanced
07-Dec-2008, 10:11 AM #7
My understanding of this problem in general is that it is a "hard" problem to solve - i.e. there's no short cut method, at least not one that shaves much off the simple brute-force methods you've investigated.

The difficulty in solving this problem (for very large numbers, bigger than 32 bit ints) is relied upon in cryptography algorithms such as RSA. If you could find the prime factors of the large numbers used (say 512 bits), you could break RSA. RSA is used on the basis that it would be infeasible to find the factors even with years of computer time.

If you've Googled around the problem (or perhaps anyway), you probably know this, but I thought I'd throw in my two penneth.

My quick Google came up with a recommendation for the Pollard-Strassen method, which (according to Mathworld) is the most efficient algorithm known. I haven't investigated how easy it would be to implement.

Regards,
Bob
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:57 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.