Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A different and better way to find prime numbers
#21
The bit number in an encryption refers to the key lenght..

It has actually little to do with how safe the encryption actually is..
A 64bit encryption could very well be safer than a 2048bit one.. as it plays down to the actuall algorithm too.. which, sadly, many modern crypto programs keep hidden..

A good encryption is safe even if the "hacker" has access to the full sourcecode..


And ya, modern encryptions use two extremely high prime numbers multiplied together to create the final key..

There's some research that is pointing towards this being a bad way though, as there might be an algorithm for finding prime numbers more efficient than the current ones of testing each number up to the one you want..

I can't remember the website that has the research data though, do a google if you're interessted.. It was reported on the news here in sweden a few years ago..
Reply
#22
Quote:
Moneo Wrote:Could some of you give me a practical application or some examples where you need to work with prime numbers. Just curious.
Encryption

Ladies and gentlemen, introducing the latest internet innovation: E-cryption :oops:
Well, like the saying goes "you learn something every day."
I didn't know that prime numbers were used in encryption algorithms.

I designed my own encryption algorithm back in 1975 for ATM transactions at Citibank NY, and I didn't use prime numbers. It would not have occurred to me to do so.
*****
Reply
#23
Quote:Jake and Rpgfan,

Either of your solutions seem to work ok.

However, for some strange reason, if the input number "n" is greater than 2,147,483,647, which is the maximum value for a LONG integer, you will get an Error 06: overflow error, when the MOD instruction gets executed.

I consulted the QB Online Help plus my Quickbasic manual and there is no mention of any maximum values for the MOD operator. However, it does mention that "real" values will be rounded to integers, and this could be a clue as to why the maximum is a long integer.

So, the bottom line is that if your number is equal or greater than 2,147,483,647 then you can't use a MOD in your logic to determine if it's a prime number.
*****

Actually, there is an algorithim for figuring out modulo arithmetic for very large numbers, but I forgot it a long time ago.
quote="Bruce Raeman"]Anatomy (n): something everyone has, but which looks better on a girl[/quote]
Reply
#24
hey i made a program that spews prime numbers!

Code:
a = -1
do
a = a +2
for i = 2 to a - 1
  if a mod i = 0 then c = 1
next
if c = 0 then ? a
c = 0
loop

and one that produces a random prime number in a specified range:

Code:
max = 10000
min = 5000
1
x = int((max-min+1)*rnd+min)
for i = 2 to x - 1
  if x mod i = 0 then goto 1
next
? x
sleep

and a website that features a bear that sh*ts prime numbers!

http://members.surfeu.fi/kklaine/primebear.html

i'm so proud of myself... :bounce:
quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Reply
#25
ROFL.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#26
nice post dio, and on the floor with aga...

a challenge...the slowest prime generator where *every* bit of code is crucial. I know of a prime generator that is made within Conway's Life...it's about 4 orders of magnitude slower than dio's...and it's an absolute work of art.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)