New Idea for Prime Number Sieve

  • Thread starter Thread starter bdonelson
  • Start date Start date
  • Tags Tags
    Prime numbers
Click For Summary

Discussion Overview

The discussion revolves around a proposed algorithm for a prime number sieve, focusing on its structure, potential efficiency, and accuracy. Participants are examining the algorithm's design, its implementation in pseudocode, and its comparison to existing prime sieving methods.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • The original poster (OP) presents an algorithm based on the subset {6X ± 1} and seeks feedback on its accuracy and efficiency.
  • Some participants question the programming language of the algorithm, suggesting it appears to be pseudocode rather than a specific implementation.
  • Concerns are raised about the use of Goto statements, with participants noting that the syntax may not be valid in many programming languages.
  • One participant expresses skepticism about the OP's claim of not finding similar algorithms, suggesting that prime number sieves are well-documented.
  • Another participant critiques the algorithm's structure, stating it lacks a clear method for determining which numbers are prime.
  • The OP defends their approach, claiming that their algorithm follows a unique pattern and has been validated through testing.
  • Participants discuss the need for a data structure to support the algorithm, questioning how certain operations are intended to function.

Areas of Agreement / Disagreement

There is no consensus on the validity or effectiveness of the proposed algorithm. Multiple viewpoints exist regarding its structure, implementation, and comparison to existing methods, indicating an unresolved debate.

Contextual Notes

Participants highlight limitations in the algorithm's clarity, particularly regarding the use of Goto statements and the absence of a definitive method for identifying prime numbers. There are also unresolved questions about the algorithm's implementation and its comparison to established prime sieving techniques.

  • #31
Ok, that does sound like a good idea. Thank you.

Maybe this is closer to what you asking for?

Here is the center of the algorithm.

Code:
// FirstStep is set to a value based on the Current Multiple of 6 Managed in the Outer Loop ( 6, 12, 18, etc. )
// SecondStep is set to a value based on the Current Odd Number ( 3, 5, 7, 9, 11, 13, 15, etc )

While (Inside = True)                                                       // Inside Loop

        {
            List.AdvanceRecords(FirstStep);                           // Advance to the next Value based on FirstStep

            If(Side = 0)
                List.MCheck();                                                   // Set the Non-Prime Flag for the Minus
            Else
                List.PCheck();                                                    // Set the Non-Prime Flag for the Plus

            List.AdvanceRecords(SecondStep)                     // Advance to the next Value based on SecondStep

            If ( SideFlag = 1)                                                // SideFlag Switches
                SideFlag = 0;
            Else
                SideFlag = 1;

            If(Side = 0)
                List.MCheck();                                                  // Set the Non-Prime Flag for the Minus
            Else
                List.PCheck();                                                   // Set the Non-Prime Flag for the Plus


            If ( SideFlag = 1)                                                 // SideFlag Switches
                SideFlag = 0;
            Else
                SideFlag = 1;

            If ( CurrentStep <= MaxMultiple )                     // MaxMultiple = Maximum Prime Value / 6

                CurrentStep = CurrentStep + FirstStep + SecondStep;    // Tracking Which Prime is Used

            Else

                Inside = False;

        }                                                                   // Inside Loop

Is this easier to follow?
 
Technology news on Phys.org
  • #32
bdonelson said:
Is this easier to follow?
Did you run it, and get a correct result?
 
  • Like
Likes   Reactions: berkeman
  • #33
Apparently, no one understands to think. Why did I waste my time. Goodbye
 
  • #34
Baluncore said:
Did you run it, and get a correct result?
I think the OP indirectly just answered that.
 
  • Like
Likes   Reactions: berkeman
  • #35
bdonelson said:
Why did I waste my time.
You failed to clearly communicate your algorithm. You only needed to code your algorithm, run it, and prove it once. It would then have been possible for us to compare that to other algorithms. You actually wasted our time.
 
  • Like
Likes   Reactions: berkeman and PeterDonis
  • #36
bdonelson said:
Apparently, no one understands to think. Why did I waste my time. Goodbye
Thread closed.
 
  • #37
bdonelson said:
I would to comment here that apparently most people here do not appear to understand the concept of psuedo code. I have seen examples of people that didn't recognize it to begin with.
I beg to differ. I'd be willing to bet that all of the people responding here are very familiar with the concept of pseudocode. Speaking for myself, I taught a variety of programming languages, at least six or seven of them, over a course of about 20 years. Pseudocode was an important part of all of these classes.

bdonelson said:
In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actions and conditions.
We're all very familiar with these concepts. What was confusing to myself and others was your unusual use of goto statements.

Thread is still closed.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
10K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 10 ·
Replies
10
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 13 ·
Replies
13
Views
7K
  • · Replies 7 ·
Replies
7
Views
3K