Code archives/Algorithms/special prime numbers

This code has been declared by its author to be Public Domain code.

Download source code

special prime numbers by Vignoli2008
Enter a multiple of 6 in the program, and the program will evaluate the first prime number after the number you entered, by trying to add little prime numbers to it.
This program can be powerfull with : blitzmax + linux + (a supercalculator or a cluster) + an adaptation of the source code to find very very big prime numbers.
I think this algorythm can be better than the mersenne algorythm.
The proof have to be done...
Local cpt:Long=0

Local i:Long=0

Local k:Long=0


a$=Input("Nombre multiple de 6 ou 'q' pour quitter (Number multiple of 6 or 'q' to quit)  :")

If Lower(a$)="q" Then End

cpt=Long(a$)

i=5
flag=0
While flag=0
		k=cpt+i
		flag=IsPremier(k)
		If KeyDown(KEY_ESCAPE)=True Then End
		If flag=1
			Print cpt+" + "+i+" = "+(cpt+i)+" est premier (is prime)"
		Else 
			Print cpt+" + "+i+" = "+(cpt+i)+" n'est PAS premier (is not prime)"
			i=i+1
			While IsPremier(i)=0
				If KeyDown(KEY_ESCAPE)=True Then End
				i=i+1
			Wend
		EndIf
Wend

End


SetClsColor 0,0,0
Cls
SetColor 255,255,255

Function IsPremier(a:Long)
	Local j:Long
	If a=0 Then Return 0
	If a=1 Then Return 0
	If a=2 Then Return 1
	If (a Mod 2)=0 Then Return 0
	For j=1 To Long((a-3)/2)
		If KeyDown(KEY_ESCAPE)=True Then End
		If (a Mod (j+1))=0 Then Return 0
	Next
	Return 1
EndFunction

Comments

Vignoli2008
After an adaptation of the source code, you can find a big prime number like this (with a supercalculator) :

6*(10^10.000.000)+p is prime, with p as a prime number, testing if the result is prime with p=5, p=7, p =11, etc...

100000$ are offered by a company on the web to find a number like this.
But money go to money... (tears...lol) because a supercalculator is very expensive !!!


Code Archives Forum