The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Silvercover on June 22, 2005, 07:19:57 AM

Title: Find out number in BX is prime or not?
Post by: Silvercover on June 22, 2005, 07:19:57 AM
Hi mates:

I need a code to determine that the binary number in BX is prime or not and based on that show apropriate message.

Thanks in advance.
::)
Title: Re: Find out number in BX is prime or not?
Post by: hutch-- on June 22, 2005, 07:37:02 AM
Two things, if you want to order code, go to rent a coder, the other is this is primarily a 32 bit forum so if you have 16 bit questions, post them in the 16 bit forum.
Title: Re: Find out number in BX is prime or not?
Post by: brixton on June 22, 2005, 10:17:17 AM
Tell us how far you have got so far  :U
Title: Re: Find out number in BX is prime or not?
Post by: Bieb on June 24, 2005, 10:10:52 PM
I think he went away.  Good job, Hutch  :U
Title: Re: Find out number in BX is prime or not?
Post by: Phil on June 24, 2005, 11:38:06 PM
I was going to suggest testing to see if could be divided evenly by any other integer other than 1 and printing 'prime' if there was always a remainder, otherwise print 'not prime' if the remainder was ever 0. I wasn't sure how they would take that though so I left it up to Hutch to make the first post. I'm so glad he wasn't asking how to compute nth Fibonacci number.

Which reminds me of a related question: Are there more Prime numbers than there are Fibonacci numbers or are there an infinite number of both? That type of thing has always confused me because if there actually are an infinite number of both AND any infinite quantity actually does equal any other infinite quantity then it would follow that there must be the same number of both. How can that be if one is actually more common than the other?


Title: Re: Find out number in BX is prime or not?
Post by: sluggy on June 25, 2005, 06:50:37 AM
There has to be an infinite number in the FIbonacci series, because each number is the sum of the two before it. And logically there would also have to be an infinite number of primes because there will always be one that can be calculated with (n*2)+1.

And one infinity cannot numerically equal another infinity, just like NULL cannot equal zero. Although there is bound to be a mathmatician that will argue that one  :toothy
Title: Re: Find out number in BX is prime or not?
Post by: AeroASM on June 25, 2005, 06:57:56 AM
There are different sizes of infinities. Like the infinity of rational numbers and the infinity of real numbers. The rational numbers are only big enough to index an infinite list.

Imagine the list of all real numbers:

r1 = 0.0123054782930...
r2 = 0.3892789598029...
r3 = 0.4789098789672...
...

Now make a new number d, where the nth digit is the (nth digit of rn) + 1

The first digit of d is not the first digit of r1
The second digit of d is not the second digit of r2
The third digit of d is not the third digit of r3
...

Hence
d is not r1
d is not r2
d is not r3
...

Therefore d is not in the list. But d is a real number!

Therefore no list of real numbers will ever be complete. Therefore there are more real numbers than an infinite list contain. Therefore there are more real numbers than those which the rational numbers can index.

Therefore there are more real numbers than rational numbers.
Title: Re: Find out number in BX is prime or not?
Post by: hutch-- on June 25, 2005, 07:12:33 AM
The notion of INFINITE has always been a problem in straight mathematical terms as it simply cannot be verified. No mater where you arrive at, there will be an infinite number of further positions and the problem flows from the term being linguistic,, not mathematical. The term usually has the sense "without end" so it can never be arrived at.

Proof is not an easy task here as deduction is at best part of a closed system of axioms which provide the deductive capacity. Induction on the other hand is limited by space/time in which there is no way to verify if anything is without end. Some cosmological theory indicates that space has curvature so if you looked long enough, you would see the back of your head at the time delay it took for light to travel that far. Further cosmological teory also says the universe if getting bigger (big bang and variations) so the rules keep changing as well.

Where does this leave proofs fpr infinite ? At ZERO, the other difficult linguistic concept in mathematics.  :bg
Title: Re: Find out number in BX is prime or not?
Post by: brixton on June 27, 2005, 10:45:22 PM
Looks like discussions about this are infinitely long too!
Title: Re: Find out number in BX is prime or not?
Post by: Phil on June 29, 2005, 08:26:51 AM
Geeze, I sure hope that Silvercover comes back to find out more about primes! Meanwhile, here's a link to 3-hours of wonderful programming that talks about Strings'n'Things (http://www.pbs.org/wgbh/nova/elegant/program.html) for anyone who might be interested. It's broken down into segments so you can watch pieces of it at your convenience!