Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I little help?
#21
low budget canadian movies should only be watched in the backdrop of an mst3k episode...
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#22
Quote:
whitetiger0990 Wrote:nope... It finds prime numbers

[Image: bangin.gif]

If I'm reading that correctly, it looks like 35 is a prime. Reminds me of the Cube *shudders at the awfulness of low budget canadian films*

Well it is sometimes both sub. and add. Sometimes not.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#23
See Challenges post regarding impossibility of prime number equation.
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
#24
It's a nice little trick, like 7/22 for pi, but it skips over numbers, and after awhile will start producing non-primes. This table has primes on the left, and 6x+1 and 6x-1 on the other side.

Code:
3             1            -1
5             7             5
7             13            11
11            19            17
13            25            23
17            31            29
19            37            35
23            43            41
29            49            47
31            55            53
37            61            59
41            67            65
43            73            71
47            79            77
53            85            83
59            91            89
61            97            95
67            103           101
71            109           107
73            115           113
79            121           119
83            127           125
89            133           131
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#25
produce prime numbers sometimes but not always. Smile
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#26
I guess I'll stick it out with Erathosthenes' Seive. :*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#27
I use it like this -

Code:
CLS
INPUT n
FOR i = 1 TO n
a = i * 6 - 1
b = i * 6 + 1
IF a <= n THEN
z = 1
DO
  z = z + 1
  IF z = a THEN PRINT a: EXIT DO
  IF a / z = INT(a / z) THEN EXIT DO
LOOP
END IF
IF b <= n THEN
z = 1
DO
  z = z + 1
  IF z = b THEN PRINT b: EXIT DO
  IF b / z = INT(b / z) THEN EXIT DO
LOOP
END IF
NEXT

I made a section that makes sure the numberis divisible only by 1 and itself. Oh and the formula is only good for primes bigger than 3
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#28
Easy to fix: if inputted value is larger than 2 or 3 then output them. But I'm too lazy to rewrite your code :wink:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)