<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.4 20241031//EN" "JATS-journalpublishing1-4.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="research-article" dtd-version="1.4" xml:lang="en">
  <front>
    <journal-meta>
      <journal-id journal-id-type="publisher-id">am</journal-id>
      <journal-title-group>
        <journal-title>Applied Mathematics</journal-title>
      </journal-title-group>
      <issn pub-type="epub">2152-7393</issn>
      <issn pub-type="ppub">2152-7385</issn>
      <publisher>
        <publisher-name>Scientific Research Publishing</publisher-name>
      </publisher>
    </journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.4236/am.2026.1711039</article-id>
      <article-id pub-id-type="publisher-id">am-155289</article-id>
      <article-categories>
        <subj-group>
          <subject>Article</subject>
        </subj-group>
        <subj-group>
          <subject>Physics</subject>
          <subject>Mathematics</subject>
        </subj-group>
      </article-categories>
      <title-group>
        <article-title>A Note on Generation of Prime Numbers</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <name name-style="western">
            <surname>Tehrani</surname>
            <given-names>Fleur T.</given-names>
          </name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
      </contrib-group>
      <aff id="aff1"><label>1</label> Department of Electrical and Computer Engineering, California State University, Fullerton, Fullerton, CA, USA </aff>
      <author-notes>
        <fn fn-type="conflict" id="fn-conflict">
          <p>The author declares no conflicts of interest regarding the publication of this paper.</p>
        </fn>
      </author-notes>
      <pub-date pub-type="epub">
        <day>13</day>
        <month>11</month>
        <year>2026</year>
      </pub-date>
      <pub-date pub-type="collection">
        <month>11</month>
        <year>2026</year>
      </pub-date>
      <volume>17</volume>
      <issue>11</issue>
      <fpage>715</fpage>
      <lpage>719</lpage>
      <history>
        <date date-type="received">
          <day>10</day>
          <month>09</month>
          <year>2026</year>
        </date>
        <date date-type="accepted">
          <day>10</day>
          <month>11</month>
          <year>2026</year>
        </date>
        <date date-type="published">
          <day>13</day>
          <month>11</month>
          <year>2026</year>
        </date>
      </history>
      <permissions>
        <copyright-statement>© 2026 by the authors and Scientific Research Publishing Inc.</copyright-statement>
        <copyright-year>2026</copyright-year>
        <license license-type="open-access">
          <license-p> This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license ( <ext-link ext-link-type="uri" xlink:href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</ext-link> ). </license-p>
        </license>
      </permissions>
      <self-uri content-type="doi" xlink:href="https://doi.org/10.4236/am.2026.1711039">https://doi.org/10.4236/am.2026.1711039</self-uri>
      <abstract>
        <p>A modified sieving algorithm is presented to generate prime numbers. The procedure is designed to be less complex and potentially less computationally intensive than other methods. This algorithm is iterative and is error-free.</p>
      </abstract>
      <kwd-group kwd-group-type="author-generated" xml:lang="en">
        <kwd>Computer Algorithm</kwd>
        <kwd>Deterministic Methods</kwd>
        <kwd>Prime Numbers</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec1">
      <title>1. Introduction</title>
      <p>A positive integer that is not the product of two other positive integers is called a prime number. Prime numbers have numerous applications, including in various technological fields. Examples of their applications include encryption and cybersecurity for protecting sensitive information, and error-correcting codes used in digital communication systems.</p>
      <p>There have been many attempts to find a formula for generating prime numbers, but none have been found to date. Prime numbers are found by using algorithmic procedures, and some of those procedures are not error-free [<xref ref-type="bibr" rid="B1">1</xref>] [<xref ref-type="bibr" rid="B2">2</xref>].</p>
      <p>The purpose of this paper is to present a modified sieving algorithm for generating prime numbers, which is designed to produce primes without error. The algorithm is iterative and designed to reduce computational time.</p>
    </sec>
    <sec id="sec2">
      <title>2. Methods</title>
      <p>Prime numbers are not limited, but it is known that the number of primes less than a number <italic>n</italic> approaches a limit as <italic>n</italic> becomes large:</p>
      <p>π(<italic>n</italic>) ~ <inline-formula><mml:math display="inline"><mml:mrow><mml:mfrac><mml:mi> n </mml:mi><mml:mrow><mml:mi> log </mml:mi><mml:mi> n </mml:mi></mml:mrow></mml:mfrac></mml:mrow></mml:math></inline-formula><xref>(1)</xref></p>
      <p>where π(<italic>n</italic>) is the number of prime numbers less than <italic>n</italic>. The difference between π(<italic>n</italic>) and the fraction on the right side of the above expression approaches zero as <italic>n</italic> tends to infinity [<xref ref-type="bibr" rid="B3">3</xref>].</p>
      <disp-formula id="FD2">
        <label>(2)</label>
        <mml:math display="inline">
          <mml:mrow>
            <mml:munder>
              <mml:mrow>
                <mml:mtext>lim</mml:mtext>
              </mml:mrow>
              <mml:mrow>
                <mml:mi>n</mml:mi>
                <mml:mo>→</mml:mo>
                <mml:mi>∞</mml:mi>
              </mml:mrow>
            </mml:munder>
            <mml:mrow>
              <mml:mo>[</mml:mo>
              <mml:mrow>
                <mml:mi>E</mml:mi>
                <mml:mrow>
                  <mml:mo>(</mml:mo>
                  <mml:mi>n</mml:mi>
                  <mml:mo>)</mml:mo>
                </mml:mrow>
                <mml:mo>=</mml:mo>
                <mml:mrow>
                  <mml:mo>(</mml:mo>
                  <mml:mrow>
                    <mml:mi>π</mml:mi>
                    <mml:mrow>
                      <mml:mo>(</mml:mo>
                      <mml:mi>n</mml:mi>
                      <mml:mo>)</mml:mo>
                    </mml:mrow>
                    <mml:mo>−</mml:mo>
                    <mml:mfrac>
                      <mml:mi>n</mml:mi>
                      <mml:mrow>
                        <mml:mi>log</mml:mi>
                        <mml:mi>n</mml:mi>
                      </mml:mrow>
                    </mml:mfrac>
                  </mml:mrow>
                  <mml:mo>)</mml:mo>
                </mml:mrow>
              </mml:mrow>
              <mml:mo>]</mml:mo>
            </mml:mrow>
            <mml:mo>=</mml:mo>
            <mml:mn>0</mml:mn>
          </mml:mrow>
        </mml:math>
      </disp-formula>
      <p>It is also known that primes less than a number <italic>n</italic>, need to be undividable by integers up to <inline-formula><mml:math display="inline"><mml:mrow><mml:msqrt><mml:mi> n </mml:mi></mml:msqrt></mml:mrow></mml:math></inline-formula> to be prime numbers [<xref ref-type="bibr" rid="B4">4</xref>].</p>
      <p>The procedure presented in this paper is designed to be deterministic and less complex than some other methods. This modified procedure has the potential to reduce computational time compared to other sieving techniques [<xref ref-type="bibr" rid="B5">5</xref>] [<xref ref-type="bibr" rid="B6">6</xref>]. In computer algorithms, it generally takes less time to find out whether a number is an integer multiple of a set of smaller numbers by iteratively omitting multiples than to eliminate the integer multiples of each individual prime separately, from beginning to end. To make the procedure more efficient, the procedure is performed in two stages; in the first stage, all the primes up to <inline-formula><mml:math display="inline"><mml:mrow><mml:msqrt><mml:mi> n </mml:mi></mml:msqrt></mml:mrow></mml:math></inline-formula> (where <italic>n</italic> is the maximum number) are found, and in the second stage, the numbers greater than <inline-formula><mml:math display="inline"><mml:mrow><mml:msqrt><mml:mi> n </mml:mi></mml:msqrt></mml:mrow></mml:math></inline-formula> are iteratively compared with subgroups of primes found in the first stage to find all prime numbers. These are done to reduce the computational intensity of the algorithm.</p>
      <p><bold>Procedure</bold></p>
      <p>A flowchart of the procedure is shown in <xref ref-type="fig" rid="fig1">Figure 1(a)</xref> and <xref ref-type="fig" rid="fig1">Figure 1(b)</xref>.</p>
      <p>As shown in <xref ref-type="fig" rid="fig1">Figure 1(a)</xref>, the maximum number, <italic>n</italic>, is read at the beginning, the square root of <italic>n</italic> is found, and the integer part of <inline-formula><mml:math><mml:msqrt><mml:mi> n </mml:mi></mml:msqrt></mml:math></inline-formula> is called K1. Then the algorithm checks all odd integers less than K1 against several initial primes (e.g., 3, 5, and 7) and places those numbers that are not multiples of this initial set of primes in file 1.</p>
      <p>As shown in <xref ref-type="fig" rid="fig1">Figure 1(b)</xref>, after the initial file 1 is formed, the procedure continues by checking each number in that file to see whether it is an integer multiple of any of the smaller numbers in the file. If it is, the number is discarded, and if not, it is kept in the file. Then the numbers in file 1 are counted, and the initial set of primes (e.g., 2, 3, 5, 7) is added to the file. </p>
      <p>At this point, file #1 contains all primes that are less than <inline-formula><mml:math display="inline"><mml:mrow><mml:msqrt><mml:mi> n </mml:mi></mml:msqrt></mml:mrow></mml:math></inline-formula> (K1). Then the numbers in file #1, starting from number 3, are subdivided into groups of several primes (e.g., groups of 3 numbers each). The next part of the procedure begins by checking every odd integer greater than K1 and up to <italic>n</italic>, versus each group of numbers in file #1. If they are found to be an integer multiple of any number in the group, they are discarded. This procedure is iterative, with numbers checked against each set in file #1, and the remaining group keeps getting smaller as multiples are found and discarded. The final remaining file is called file #2 and is added to file 1 to form the final file of prime numbers less than <italic>n</italic>. The numbers in the file are counted and then printed.</p>
      <p>An example print-out of primes generated by this procedure, less than 1000, is shown in <xref ref-type="fig" rid="fig2">Figure 2</xref>. This relatively small sample is presented to show that the results produced by the proposed method are accurate and error-free.</p>
      <fig id="fig1">
        <label>Figure 1</label>
        <caption>
          <p>Flowchart of the procedure.</p>
        </caption>
        <graphic xlink:href="https://html.scirp.org/file/7405703-rId22.jpeg?20261113111756" />
        <graphic xlink:href="https://html.scirp.org/file/7405703-rId23.jpeg?20261113111756" />
      </fig>
      <fig id="fig2">
        <label>Figure 2</label>
        <caption>
          <p>An example set of prime numbers produced by the flowchart algorithm.</p>
        </caption>
        <graphic xlink:href="https://html.scirp.org/file/7405703-rId24.jpeg?20261113111756" />
      </fig>
      <p>The procedure presented here describes a modified sieving method that does not include complex mathematical functions. It is designed to be error-free, and the built-in modifications are intended to reduce computational intensity, especially as the maximum number increases. <bold>Table 1</bold> compares the computational times of this method, referred to as “Flowchart Algorithm”, and the widely used sieve of Eratosthenes for <italic>n</italic> = 10<sup>3</sup>, 10<sup>5</sup>, and 10<sup>6</sup>. As seen in this table, the time efficiency of this method, compared with the sieve of Eratosthenes, increases as <italic>n</italic> increases.</p>
      <p><bold>Table 1.</bold>Benchmark results—comparison of the execution times of the Flowchart Algorithm with the Algorithm of Eratosthenes for different maximum numbers. </p>
      <table-wrap id="tbl1">
        <label>Table 1</label>
        <table>
          <tbody>
            <tr>
              <td>Maximum Number</td>
              <td>Prime Count</td>
              <td>Exec. Time of Flowchart Algorithm (ms)</td>
              <td>Exec. Time of Eratosthenes Algorithm (ms)</td>
            </tr>
            <tr>
              <td>
                <bold>1000</bold>
              </td>
              <td>
                <bold>168</bold>
              </td>
              <td>
                <bold>0.058</bold>
              </td>
              <td>
                <bold>0.067</bold>
              </td>
            </tr>
            <tr>
              <td>
                <bold>100</bold>
                <bold>,</bold>
                <bold>000</bold>
              </td>
              <td>
                <bold>9592</bold>
              </td>
              <td>
                <bold>6.539</bold>
              </td>
              <td>
                <bold>7.552</bold>
              </td>
            </tr>
            <tr>
              <td>
                <bold>1</bold>
                <bold>,</bold>
                <bold>000</bold>
                <bold>,</bold>
                <bold>000</bold>
              </td>
              <td>
                <bold>78</bold>
                <bold>,</bold>
                <bold>498</bold>
              </td>
              <td>
                <bold>75.485</bold>
              </td>
              <td>
                <bold>78.826</bold>
              </td>
            </tr>
          </tbody>
        </table>
      </table-wrap>
    </sec>
    <sec id="sec3">
      <title>3. Conclusion</title>
      <p>Prime numbers have many applications in mathematics and other fields of science and technology. Efficient production of prime numbers has been the focus of research by many mathematicians and computer scientists. The procedure presented in this paper is a modified sieving method designed to generate primes without error, and its iterative nature is intended to reduce computational time.</p>
    </sec>
    <sec id="sec4">
      <title>Acknowledgements</title>
      <p>I want to thank Mr. Vadim Chissek, the Electrical and Computer Engineering Consultant at California State University, Fullerton, for helping verify the algorithmic results.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <title>References</title>
      <ref id="B1">
        <label>1.</label>
        <citation-alternatives>
          <mixed-citation publication-type="other">Grosswald, E. (1966) Topics from the Theory of Numbers. The Macmillan Company, 113-116.</mixed-citation>
          <element-citation publication-type="other">
            <person-group person-group-type="author">
              <string-name>Grosswald, E.</string-name>
            </person-group>
            <year>1966</year>
            <article-title>Topics from the Theory of Numbers</article-title>
            <source>The Macmillan Company</source>
            <volume>113</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B2">
        <label>2.</label>
        <citation-alternatives>
          <mixed-citation publication-type="book">Kraft, J.S. and Washington, L.C. (2015) Elementary Number Theory. CRC Press.</mixed-citation>
          <element-citation publication-type="book">
            <person-group person-group-type="author">
              <string-name>Kraft, J.S.</string-name>
              <string-name>Washington, L.C.</string-name>
            </person-group>
            <year>2015</year>
            <article-title>Elementary Number Theory</article-title>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B3">
        <label>3.</label>
        <citation-alternatives>
          <mixed-citation publication-type="book">Grandall, R. and Pomerance, C. (2005) Prime Numbers, A Computational Perspective. 2nd Edition, Springer, 121-131.</mixed-citation>
          <element-citation publication-type="book">
            <person-group person-group-type="author">
              <string-name>Grandall, R.</string-name>
              <string-name>Pomerance, C.</string-name>
              <string-name>Numbers, A</string-name>
              <string-name>Edition, S</string-name>
            </person-group>
            <year>2005</year>
            <article-title>Prime Numbers, A Computational Perspective</article-title>
            <source>2nd Edition</source>
            <volume>121</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B4">
        <label>4.</label>
        <citation-alternatives>
          <mixed-citation publication-type="book">Giblin, P. (1993) Primes and Programming, an Introduction to Number Theory and Computing. Cambridge University Press.</mixed-citation>
          <element-citation publication-type="book">
            <person-group person-group-type="author">
              <string-name>Giblin, P.</string-name>
            </person-group>
            <year>1993</year>
            <article-title>Primes and Programming, an Introduction to Number Theory and Computing</article-title>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B5">
        <label>5.</label>
        <citation-alternatives>
          <mixed-citation publication-type="other">Greaves, G. (2013) Sieves in Number Theory. Springer, 1-18.</mixed-citation>
          <element-citation publication-type="other">
            <person-group person-group-type="author">
              <string-name>Greaves, G.</string-name>
            </person-group>
            <year>2013</year>
            <article-title>Sieves in Number Theory</article-title>
            <source>Springer</source>
            <volume>1</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
      <ref id="B6">
        <label>6.</label>
        <citation-alternatives>
          <mixed-citation publication-type="other">Wagstaff Jr., S.S. (2013) The Joy of Factoring. American Mathematical Society, 191-198.</mixed-citation>
          <element-citation publication-type="other">
            <year>2013</year>
            <article-title>The Joy of Factoring</article-title>
            <source>American Mathematical Society</source>
            <volume>191</volume>
          </element-citation>
        </citation-alternatives>
      </ref>
    </ref-list>
  </back>
</article>