You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,560

Want to discover all the factors of a number (not just the prime factors)? Try my new All Factors of a Number Tool.

Let me know if it does something odd.

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**Patrick****Real Member**- Registered: 2006-02-24
- Posts: 1,005

The Prime Factors of 256 are: 2,2,2,2,2,2,2,2

wow, I had no idea!

Support MathsIsFun.com by clicking on the banners.

What music do I listen to? Clicky click

Offline

**Devantè****Real Member**- Registered: 2006-07-14
- Posts: 6,400

Sometimes works, sometimes doesn't work. First time, didn't work on any numbers at all. Second time, it only worked on one or two numbers selected. Good program, but sometimes it just doesn't give a result. :\

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,560

Devanté wrote:

Sometimes works, sometimes doesn't work. First time, didn't work on any numbers at all. Second time, it only worked on one or two numbers selected. Good program, but sometimes it just doesn't give a result. :\

Odd indeed! Works every time for me. Maybe something to do with Flash Player, or ... ?

Does anyone else see this? Is there an example for me trace down?

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**mathsyperson****Moderator**- Registered: 2005-06-22
- Posts: 4,900

Ooh, that's a very useful tool indeed. I tried to make a similar thing in Excel a while ago, but didn't really get anywhere. I managed to figure out a way of working out how many factors a number will have though.

Put your number in the form of 2^a * 3^b * 5^c * 7^d * ..., showing all of its prime factors.

Then find the product of (a+1), (b+1), (c+1) and so on.

e.g. 24 would be written as 2^3 * 3^1 * 5^0 * ...

Therefore, 24 has (3+1) * (1+1) * (0+1) * ... = 4*2 = 8 factors.

Of course, your tool could tell you that anyway, but it's still quite useful if you don't have a computer handy.

Oh, and the tool works perfectly for me every time, by the way.

Why did the vector cross the road?

It wanted to be normal.

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,560

Hi mathsy! Long time no see.

I use every combination of prime factor.

If there are n primes, then there are 2[sup]n[/sup] combinations. This can be a problem for a simple number like 1,000,000 which has 12 prime factors (2,2,2,2,2,2,5,5,5,5,5,5), and so has 4096 combinations to check. Try it, you will notice it slows down.

Glad to have you back.

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**mathsyperson****Moderator**- Registered: 2005-06-22
- Posts: 4,900

Glad to be back! It turns out that the problem with my internet was so ridiculously simple that I completely missed it.

Ah well, I'm back now.

In your example, with the factors of 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, almost all of the possible combinations are repeats of other possible combinations.

I don't know if it's possible to program, but if you could make the computer think of it as 2^6 and 5^6 instead, then it would be much quicker.

Instead of doing 1, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, 2*2, 2*2, 2*2, 2*2, 2*2, 2*5, 2*5, and so on, having to disregard most of its calculations because it had already worked them out, it could do 1, 2, 2^2, 2^3, 2^4, 2^5, 2^6, 5, 2*5, 2^2*5, 2^3,*5, 2^4*5, 2^5*5, 2^6*5, 5^2, 2*5^2, 2^2*5^2 and so on, with each calculation producing a different factor and so being much more efficient.

Why did the vector cross the road?

It wanted to be normal.

Offline

Pages: **1**