Need help with prime Test

• To: mathgroup at smc.vnet.net
• Subject: [mg124905] Need help with prime Test
• From: KenR <ramsey2879 at msn.com>
• Date: Sat, 11 Feb 2012 06:39:41 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

I need to generate more "Ramsey" Numbers to further verify that only
prime numbers can meet the criteria. Ramsey numbers are those
generated from a simple criteria that is easy to check. I imported a
CSV list into my Mathematica version 8 to check all 30,759 numbers
that my Excel macro selected and they all turned out to be prime. That
is all that my program selected from all odd numbers from 3 to
1,048,655, as large as my Excel program could test. I would further
test my program using my Mathematica software but I would like some
help to write the most efficient program to do the job.  Right now, I
am trying to write a while loop inside a do loop but don't know how to
exit the loop before the counter becomes 0 in the case that it is
clear that P is not prime.

The check is to do the following binary recursive sequence mod P and
check to see that the (P-1)/2 term is zero and no term prior to that
is zero. If so then I believe P should be prime based upon the results
so far.

The test sequence is S(0) = 2, S(1) = 3, S(n) = 6*S(n-1) - S(n-2) - 6.
It appears that S((P-1)/2) is divisible by P then P is very likely
Prime, but I am interested in a test that is valid only for primes.
S((35-1)/2) is divisible by 35 but that is not the first term
divisible by 35. Only about 1/3 of the primes seem to meet the more
restricted criteria, i.e. the sequence has no term divisible by P
prior to S((P-1)/2).

• Prev by Date: Re: How to call 'Clear' from within a function?
• Next by Date: Shouldn't DurbinWatsonD be an options of NonlinearModelFit?
• Previous by thread: Need Help with Sow within While Loop
• Next by thread: Re: Need help with prime Test