Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help me

2 views
Skip to first unread message

pandian rv

unread,
Sep 2, 2010, 10:24:46 AM9/2/10
to
(2^n)+1 where n is 3digit num from 100 to 999.
and result is prome or not???

Jussi Piitulainen

unread,
Sep 2, 2010, 1:24:15 PM9/2/10
to
pandian rv writes:

> (2^n)+1 where n is 3digit num from 100 to 999.
> and result is prome or not???

Assuming a prome is a prime, I found on the web the following
information about 2^n + 1, quite easily:

Part B: Show that if 2^n + 1 is prime, where n >= 1, then n must be
of the form 2^k for some positive integer k.

<http://www.physicsforums.com/showthread.php?t=178199>

There is a proof on that page. I didn't read it, but you may want to
if you decide to use the result. It might even be false, you know.

The result means that there are only three possible primes of this
form, because only three n between 100 and 999 are 2^k, so you could
focus on learning how to check whether a given number is a prime or
not, code a method to do that, and then apply it to these three. You
know what three n I have in mind, do you? Above 64, below 1024.

The 2^n + 1 are large, between 1267650600228229401496703205377 and
5357543035931336604742125245300009052807024058527668037218751941851
7552556246806124659918940784792906379733645877657341259357264284615
7021799228878734928740196728388741211549271053730253118557093897709
1076523237491790970633699383779582771973038531457285598238843271083
830214915826312193418602834034689 (those are the digits of 2^999 + 1
split over five lines) so you can not use the primitive number types
(like int, long, double) in Java. I suppose you have your reasons for
doing this in Java. (Or I may not be up to date with Java's numbers.)
There is a Java class, BigDecimal or BigInteger or something, that
handles large integers.

Oh well. I searched the web some more and found out that these numbers
of the form 2^(2^k) + 1 are called Fermat numbers and conjectured to
be composite apart from the first five, and you can divide your three
candidates by 59649589127497217, 1238926361552897, 2424833,
respectively. Try showing _that_ in Java if you cannot learn to
implement a primality checker, if you are doing this to learn Java.

(You didn't say why you need to know and why you are asking in this
group. I also made the subject line more informative.)

John B. Matthews

unread,
Sep 2, 2010, 1:45:20 PM9/2/10
to
In article
<d8a54068-a84c-4c43...@l25g2000prn.googlegroups.com>,
pandian rv <pandian...@gmail.com> wrote:

> (2^n)+1 where n is 3digit num from 100 to 999.

> and result is prime or not???

If 2^n + 1 is prime, where n > 2, then n must be of the form 2^k for
some positive integer k [1, 2]. The relevant Fermat numbers, F7 through
F10, are all composite [2, 3].

Ob Java: BigInteger may be used to verify the result, at least
stochastically [4].

[1]<http://www.physicsforums.com/showthread.php?t=178199>
[2]<http://en.wikipedia.org/wiki/Fermat_number>
[3]<http://wwwmaths.anu.edu.au/~brent/pub/pub161.html>
[4]<http://download.oracle.com/javase/6/docs/api/java/math/BigInteger.html>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

John B. Matthews

unread,
Sep 2, 2010, 2:03:39 PM9/2/10
to
In article <qotaao0...@ruuvi.it.helsinki.fi>,
Jussi Piitulainen <jpii...@ling.helsinki.fi> wrote:
[...]

> <http://www.physicsforums.com/showthread.php?t=178199>
>
> There is a proof on that page. I didn't read it, but you may want to
> if you decide to use the result. It might even be false, you know.

I was curious about that, too. There's a lemma here that made it a
little easier for me to follow.

<http://en.wikipedia.org/wiki/Fermat_number#Other_theorems_about_Fermat_numbers>

Using BigInteger, I am now more than 98% sure. :-)

> The result means that there are only three possible primes of this

> form...

Oops, I miscounted; there are indeed three candidates for n in the
range 100 through 999.

0 new messages