News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Find out number in BX is prime or not?

Started by Silvercover, June 22, 2005, 07:19:57 AM

Previous topic - Next topic

Silvercover

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.
::)

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

brixton

Tell us how far you have got so far  :U
If you love somebody, set them free.
If they return, they were always yours. If they don't, they never were..

Bieb

I think he went away.  Good job, Hutch  :U

Phil

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?



sluggy

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

AeroASM

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.

hutch--

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
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

brixton

Looks like discussions about this are infinitely long too!
If you love somebody, set them free.
If they return, they were always yours. If they don't, they never were..

Phil

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 for anyone who might be interested. It's broken down into segments so you can watch pieces of it at your convenience!