home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!sdd.hp.com!decwrl!bu.edu!news.tufts.edu!news.tufts.edu!rdorich
- From: rdorich@jade.tufts.edu (Rob)
- Newsgroups: comp.lang.c
- Subject: finding prime numebrs
- Message-ID: <RDORICH.92Dec21191037@jade.tufts.edu>
- Date: 22 Dec 92 00:21:59 GMT
- Sender: news@news.tufts.edu (USENET News System)
- Distribution: wold
- Organization: Tufts University - Medford, MA
- Lines: 37
-
-
- Since some one else had something to prove in this newsgroup,
- I'm going to post this (do we have/need a group gen.nums.proves?).
- Ok, so here it goes:
-
- For any prime number, if we represent it in base 3, and then
- get the addition of all the digits, I claim that:
-
- 1.- If the sum is even, then it is not a prime.
-
- 2.- If it is odd:
- It is either prime.
- or a multiple of another lower prime.
-
- Ages ago (about 2 years) I made a little Pascal (ugh) program to do
- this, and it basically goes from 1 to n creating and checking if the
- current number is prime, if it is, add it to a list. Basically the
- program has the following runtime:
-
- n + num_primes_to(n)
-
- which is a O(n) as n -> oo (infinity).
-
- How do you guys like this? proves? counterexamples? anything
- would be most welcome.
-
- Rob
-
-
-
- --
- -------------------------------------------------------------------------------
- Roberto Dorich | /~~ \ / ~~/~~ /~~/ /~~ /| / /~~
- | SKI /-- X / /__/ /-- / |/ | /--
- Electrical Engineering | /__ / \ / /\ /__ / | /__
- rdorich@jade.tufts.edu | Tufts University, College of Engineering.
- -------------------------------------------------------------------------------
-