Primes from the sum of the first n repunits $1+11+111+1111+11111+…$












1












$begingroup$


Is there prime number of the form $1+11+111+1111+11111+...$. I've checked it up to first 2000 repunits, but i found none. If $R_1=1$, $R_2=1+11$, $R_3=1+11+111$, $R_n=1+11+111+...+$nth repunit. What is the smallest n such that $R_n$ is prime ?










share|cite|improve this question









$endgroup$



migrated from mathematica.stackexchange.com Jan 28 at 13:49


This question came from our site for users of Wolfram Mathematica.


















  • $begingroup$
    Welcome to Mathematica.SE. Are you sure you are posting on the right site? There is nothing in your question making it clear that it is concerned with Mathematica software.
    $endgroup$
    – m_goldberg
    Jan 28 at 6:11










  • $begingroup$
    Msc is for mathematic right?
    $endgroup$
    – Armando T
    Jan 28 at 6:20










  • $begingroup$
    Mathematics and Mathematica stack exchange is different?
    $endgroup$
    – Armando T
    Jan 28 at 6:24






  • 1




    $begingroup$
    Mathematica.stackexchange.com is concerned with the computing software Mathematica from Wolfram Research. Math.stackexchange.com is concerned with pure mathematics.
    $endgroup$
    – MassDefect
    Jan 28 at 6:54
















1












$begingroup$


Is there prime number of the form $1+11+111+1111+11111+...$. I've checked it up to first 2000 repunits, but i found none. If $R_1=1$, $R_2=1+11$, $R_3=1+11+111$, $R_n=1+11+111+...+$nth repunit. What is the smallest n such that $R_n$ is prime ?










share|cite|improve this question









$endgroup$



migrated from mathematica.stackexchange.com Jan 28 at 13:49


This question came from our site for users of Wolfram Mathematica.


















  • $begingroup$
    Welcome to Mathematica.SE. Are you sure you are posting on the right site? There is nothing in your question making it clear that it is concerned with Mathematica software.
    $endgroup$
    – m_goldberg
    Jan 28 at 6:11










  • $begingroup$
    Msc is for mathematic right?
    $endgroup$
    – Armando T
    Jan 28 at 6:20










  • $begingroup$
    Mathematics and Mathematica stack exchange is different?
    $endgroup$
    – Armando T
    Jan 28 at 6:24






  • 1




    $begingroup$
    Mathematica.stackexchange.com is concerned with the computing software Mathematica from Wolfram Research. Math.stackexchange.com is concerned with pure mathematics.
    $endgroup$
    – MassDefect
    Jan 28 at 6:54














1












1








1





$begingroup$


Is there prime number of the form $1+11+111+1111+11111+...$. I've checked it up to first 2000 repunits, but i found none. If $R_1=1$, $R_2=1+11$, $R_3=1+11+111$, $R_n=1+11+111+...+$nth repunit. What is the smallest n such that $R_n$ is prime ?










share|cite|improve this question









$endgroup$




Is there prime number of the form $1+11+111+1111+11111+...$. I've checked it up to first 2000 repunits, but i found none. If $R_1=1$, $R_2=1+11$, $R_3=1+11+111$, $R_n=1+11+111+...+$nth repunit. What is the smallest n such that $R_n$ is prime ?







prime-numbers






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 28 at 5:31







Armando T











migrated from mathematica.stackexchange.com Jan 28 at 13:49


This question came from our site for users of Wolfram Mathematica.









migrated from mathematica.stackexchange.com Jan 28 at 13:49


This question came from our site for users of Wolfram Mathematica.














  • $begingroup$
    Welcome to Mathematica.SE. Are you sure you are posting on the right site? There is nothing in your question making it clear that it is concerned with Mathematica software.
    $endgroup$
    – m_goldberg
    Jan 28 at 6:11










  • $begingroup$
    Msc is for mathematic right?
    $endgroup$
    – Armando T
    Jan 28 at 6:20










  • $begingroup$
    Mathematics and Mathematica stack exchange is different?
    $endgroup$
    – Armando T
    Jan 28 at 6:24






  • 1




    $begingroup$
    Mathematica.stackexchange.com is concerned with the computing software Mathematica from Wolfram Research. Math.stackexchange.com is concerned with pure mathematics.
    $endgroup$
    – MassDefect
    Jan 28 at 6:54


















  • $begingroup$
    Welcome to Mathematica.SE. Are you sure you are posting on the right site? There is nothing in your question making it clear that it is concerned with Mathematica software.
    $endgroup$
    – m_goldberg
    Jan 28 at 6:11










  • $begingroup$
    Msc is for mathematic right?
    $endgroup$
    – Armando T
    Jan 28 at 6:20










  • $begingroup$
    Mathematics and Mathematica stack exchange is different?
    $endgroup$
    – Armando T
    Jan 28 at 6:24






  • 1




    $begingroup$
    Mathematica.stackexchange.com is concerned with the computing software Mathematica from Wolfram Research. Math.stackexchange.com is concerned with pure mathematics.
    $endgroup$
    – MassDefect
    Jan 28 at 6:54
















$begingroup$
Welcome to Mathematica.SE. Are you sure you are posting on the right site? There is nothing in your question making it clear that it is concerned with Mathematica software.
$endgroup$
– m_goldberg
Jan 28 at 6:11




$begingroup$
Welcome to Mathematica.SE. Are you sure you are posting on the right site? There is nothing in your question making it clear that it is concerned with Mathematica software.
$endgroup$
– m_goldberg
Jan 28 at 6:11












$begingroup$
Msc is for mathematic right?
$endgroup$
– Armando T
Jan 28 at 6:20




$begingroup$
Msc is for mathematic right?
$endgroup$
– Armando T
Jan 28 at 6:20












$begingroup$
Mathematics and Mathematica stack exchange is different?
$endgroup$
– Armando T
Jan 28 at 6:24




$begingroup$
Mathematics and Mathematica stack exchange is different?
$endgroup$
– Armando T
Jan 28 at 6:24




1




1




$begingroup$
Mathematica.stackexchange.com is concerned with the computing software Mathematica from Wolfram Research. Math.stackexchange.com is concerned with pure mathematics.
$endgroup$
– MassDefect
Jan 28 at 6:54




$begingroup$
Mathematica.stackexchange.com is concerned with the computing software Mathematica from Wolfram Research. Math.stackexchange.com is concerned with pure mathematics.
$endgroup$
– MassDefect
Jan 28 at 6:54










3 Answers
3






active

oldest

votes


















3












$begingroup$

Here's the smallest such prime, found using this code:



Select[Accumulate[Table[
Sum[10^i, {i, 0, n}],
{n, 0, 10000}]], PrimeQ]


$$1234567901234567901234567901234567901234567901234567901234567901234567
9012345679012345679012345679012345679012345679012345679012345679012345
6790123456790123456790123456790123456790123456790123456790123456790123
4567901234567901234567901234567901234567901234567901234567901234567901
2345679012345679012345679012345679012345679012345679012345679012345679
0123456790123456790123456790123456790123456790123456790123456790123456
7901234567901234567901234567901234567901234567901234567901234567901234
5679012345679012345679012345679012345679012345679012345679012345679012
3456790123456790123456790123456790123456790123456790123456790123456790
1234567901234567901234567901234567901234567901234567901234567901234567
9012345679012345679012345679012345679012345679012345679012345679012345
6790123456790123456790123456790123456790123456790123456790123456790123
4567901234567901234567901234567901234567901234567901234567901234567901
2345679012345679012345679012345679012345679012345679012345679012345679
0123456790123456790123456790123456790123456790123456790123456790123456
7901234567901234567901234567901234567901234567901234567901234567901234
5679012345679012345679012345679012345679012345679012345679012345679012
3456790123456790123456790123456790123456790123456790123456790123456790
1234567901234567901234567901234567901234567901234567901234567901234567
9012345679012345679012345679012345679012345679012345679012345679012345
6790123456790123456790123456790123456790123456790123456790123456790123
4567901234567901234567901234567901234567901234567901234567901234567901
2345679012345679012345679012345679012345679012345679012345679012345679
0123456790123456790123456790123456790123456790123456790123456790123456
7901234567901234567901234567901234567901234567901234567901234567901234
5679012345679012345679012345679012345679012345679012345679012345679012
3456790123456790123456790123456790123456790123456790123456790123456790
1234567901234567901234567901234567901234567901234567901234567901234567
9012345679012345679012345679012345679012345679012345679012345679012345
6790123456790123456790123456790123456790123456790123456790123456790123
4567901234567901234567901234567901234567901234567901234567901234567901
2345679012345679012345679012345679012345679012345679012345679012345679
0123456790123456790123456790123456790123456790123456790123456790123456
7901234567901234567901234567901234567901234567901234567901234567901234
5679012345679012345679012345679012345679012345679012345679012345679012
34567901234567901234567901234567901234567900957$$






share|cite|improve this answer









$endgroup$





















    3












    $begingroup$

    The first one is at $n=2497$, you just missed it!



    Do[If[PrimeQ[(10^(n+1)-9n-10)/81], Print[n]], {n, 10^4}]
    (* 2497 *)
    (* 3301 *)
    ...


    The direct formula for the $n^{text{th}}$ term is from



    Sum[10^j, {i, 0, n - 1}, {j, 0, i}]
    (* 1/81 (-10 + 10^(1 + n) - 9 n) *)





    share|cite|improve this answer









    $endgroup$





















      0












      $begingroup$

      To give some more examples of solutions, using Roman's direct formula for conciseness (alternately you can do something like r = 10*r+1; N += r in the loop).



      Pari/GP (test is AES BPSW):



      ? for(n=1,6000,ispseudoprime((10^(n+1)-9*n-10)/81) && print(n))
      2497
      3301
      time = 2min, 5,916 ms.


      Perl/ntheory (v0.74) (test is ES BPSW):



      $ time perl -Mntheory=:all -E 'is_prob_prime(divint(powint(10,$_+1)-9*$_-10,81)) and say for 1..6000;'
      2497
      3301
      real 0m44.473s


      PFGW (test is base 3 Fermat):



      $ echo -e "ABC2 (10^($a+1)-9*$a-10)/81na: from 1 to 6000" > repsum.txt
      $
      time ./pfgw64 -k -u0 -f50 repsum.txt
      (10^(2497+1)-9*2497-10)/81 is 3-PRP! (0.0793s+0.0362s)
      (10^(3301+1)-9*3301-10)/81 is 3-PRP! (0.1333s+0.0615s)
      real 0m42.963s


      As the size gets larger, PFGW will get much faster relative to the others. E.g. times on Macbook Pro (2015) for checking n from 6001 to 7000 the times are 88.9s for Pari/GP, 26.0s for Perl/ntheory, and 13.4s for PFGW. Albeit for any discovered values we'd want to run another more strict test such as BPSW.






      share|cite|improve this answer









      $endgroup$














        Your Answer





        StackExchange.ifUsing("editor", function () {
        return StackExchange.using("mathjaxEditing", function () {
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
        });
        });
        }, "mathjax-editing");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "69"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        noCode: true, onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3090879%2fprimes-from-the-sum-of-the-first-n-repunits-111111111111111%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown
























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3












        $begingroup$

        Here's the smallest such prime, found using this code:



        Select[Accumulate[Table[
        Sum[10^i, {i, 0, n}],
        {n, 0, 10000}]], PrimeQ]


        $$1234567901234567901234567901234567901234567901234567901234567901234567
        9012345679012345679012345679012345679012345679012345679012345679012345
        6790123456790123456790123456790123456790123456790123456790123456790123
        4567901234567901234567901234567901234567901234567901234567901234567901
        2345679012345679012345679012345679012345679012345679012345679012345679
        0123456790123456790123456790123456790123456790123456790123456790123456
        7901234567901234567901234567901234567901234567901234567901234567901234
        5679012345679012345679012345679012345679012345679012345679012345679012
        3456790123456790123456790123456790123456790123456790123456790123456790
        1234567901234567901234567901234567901234567901234567901234567901234567
        9012345679012345679012345679012345679012345679012345679012345679012345
        6790123456790123456790123456790123456790123456790123456790123456790123
        4567901234567901234567901234567901234567901234567901234567901234567901
        2345679012345679012345679012345679012345679012345679012345679012345679
        0123456790123456790123456790123456790123456790123456790123456790123456
        7901234567901234567901234567901234567901234567901234567901234567901234
        5679012345679012345679012345679012345679012345679012345679012345679012
        3456790123456790123456790123456790123456790123456790123456790123456790
        1234567901234567901234567901234567901234567901234567901234567901234567
        9012345679012345679012345679012345679012345679012345679012345679012345
        6790123456790123456790123456790123456790123456790123456790123456790123
        4567901234567901234567901234567901234567901234567901234567901234567901
        2345679012345679012345679012345679012345679012345679012345679012345679
        0123456790123456790123456790123456790123456790123456790123456790123456
        7901234567901234567901234567901234567901234567901234567901234567901234
        5679012345679012345679012345679012345679012345679012345679012345679012
        3456790123456790123456790123456790123456790123456790123456790123456790
        1234567901234567901234567901234567901234567901234567901234567901234567
        9012345679012345679012345679012345679012345679012345679012345679012345
        6790123456790123456790123456790123456790123456790123456790123456790123
        4567901234567901234567901234567901234567901234567901234567901234567901
        2345679012345679012345679012345679012345679012345679012345679012345679
        0123456790123456790123456790123456790123456790123456790123456790123456
        7901234567901234567901234567901234567901234567901234567901234567901234
        5679012345679012345679012345679012345679012345679012345679012345679012
        34567901234567901234567901234567901234567900957$$






        share|cite|improve this answer









        $endgroup$


















          3












          $begingroup$

          Here's the smallest such prime, found using this code:



          Select[Accumulate[Table[
          Sum[10^i, {i, 0, n}],
          {n, 0, 10000}]], PrimeQ]


          $$1234567901234567901234567901234567901234567901234567901234567901234567
          9012345679012345679012345679012345679012345679012345679012345679012345
          6790123456790123456790123456790123456790123456790123456790123456790123
          4567901234567901234567901234567901234567901234567901234567901234567901
          2345679012345679012345679012345679012345679012345679012345679012345679
          0123456790123456790123456790123456790123456790123456790123456790123456
          7901234567901234567901234567901234567901234567901234567901234567901234
          5679012345679012345679012345679012345679012345679012345679012345679012
          3456790123456790123456790123456790123456790123456790123456790123456790
          1234567901234567901234567901234567901234567901234567901234567901234567
          9012345679012345679012345679012345679012345679012345679012345679012345
          6790123456790123456790123456790123456790123456790123456790123456790123
          4567901234567901234567901234567901234567901234567901234567901234567901
          2345679012345679012345679012345679012345679012345679012345679012345679
          0123456790123456790123456790123456790123456790123456790123456790123456
          7901234567901234567901234567901234567901234567901234567901234567901234
          5679012345679012345679012345679012345679012345679012345679012345679012
          3456790123456790123456790123456790123456790123456790123456790123456790
          1234567901234567901234567901234567901234567901234567901234567901234567
          9012345679012345679012345679012345679012345679012345679012345679012345
          6790123456790123456790123456790123456790123456790123456790123456790123
          4567901234567901234567901234567901234567901234567901234567901234567901
          2345679012345679012345679012345679012345679012345679012345679012345679
          0123456790123456790123456790123456790123456790123456790123456790123456
          7901234567901234567901234567901234567901234567901234567901234567901234
          5679012345679012345679012345679012345679012345679012345679012345679012
          3456790123456790123456790123456790123456790123456790123456790123456790
          1234567901234567901234567901234567901234567901234567901234567901234567
          9012345679012345679012345679012345679012345679012345679012345679012345
          6790123456790123456790123456790123456790123456790123456790123456790123
          4567901234567901234567901234567901234567901234567901234567901234567901
          2345679012345679012345679012345679012345679012345679012345679012345679
          0123456790123456790123456790123456790123456790123456790123456790123456
          7901234567901234567901234567901234567901234567901234567901234567901234
          5679012345679012345679012345679012345679012345679012345679012345679012
          34567901234567901234567901234567901234567900957$$






          share|cite|improve this answer









          $endgroup$
















            3












            3








            3





            $begingroup$

            Here's the smallest such prime, found using this code:



            Select[Accumulate[Table[
            Sum[10^i, {i, 0, n}],
            {n, 0, 10000}]], PrimeQ]


            $$1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            3456790123456790123456790123456790123456790123456790123456790123456790
            1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            3456790123456790123456790123456790123456790123456790123456790123456790
            1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            3456790123456790123456790123456790123456790123456790123456790123456790
            1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            34567901234567901234567901234567901234567900957$$






            share|cite|improve this answer









            $endgroup$



            Here's the smallest such prime, found using this code:



            Select[Accumulate[Table[
            Sum[10^i, {i, 0, n}],
            {n, 0, 10000}]], PrimeQ]


            $$1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            3456790123456790123456790123456790123456790123456790123456790123456790
            1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            3456790123456790123456790123456790123456790123456790123456790123456790
            1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            3456790123456790123456790123456790123456790123456790123456790123456790
            1234567901234567901234567901234567901234567901234567901234567901234567
            9012345679012345679012345679012345679012345679012345679012345679012345
            6790123456790123456790123456790123456790123456790123456790123456790123
            4567901234567901234567901234567901234567901234567901234567901234567901
            2345679012345679012345679012345679012345679012345679012345679012345679
            0123456790123456790123456790123456790123456790123456790123456790123456
            7901234567901234567901234567901234567901234567901234567901234567901234
            5679012345679012345679012345679012345679012345679012345679012345679012
            34567901234567901234567901234567901234567900957$$







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Jan 28 at 6:47









            David G. StorkDavid G. Stork

            11.5k41533




            11.5k41533























                3












                $begingroup$

                The first one is at $n=2497$, you just missed it!



                Do[If[PrimeQ[(10^(n+1)-9n-10)/81], Print[n]], {n, 10^4}]
                (* 2497 *)
                (* 3301 *)
                ...


                The direct formula for the $n^{text{th}}$ term is from



                Sum[10^j, {i, 0, n - 1}, {j, 0, i}]
                (* 1/81 (-10 + 10^(1 + n) - 9 n) *)





                share|cite|improve this answer









                $endgroup$


















                  3












                  $begingroup$

                  The first one is at $n=2497$, you just missed it!



                  Do[If[PrimeQ[(10^(n+1)-9n-10)/81], Print[n]], {n, 10^4}]
                  (* 2497 *)
                  (* 3301 *)
                  ...


                  The direct formula for the $n^{text{th}}$ term is from



                  Sum[10^j, {i, 0, n - 1}, {j, 0, i}]
                  (* 1/81 (-10 + 10^(1 + n) - 9 n) *)





                  share|cite|improve this answer









                  $endgroup$
















                    3












                    3








                    3





                    $begingroup$

                    The first one is at $n=2497$, you just missed it!



                    Do[If[PrimeQ[(10^(n+1)-9n-10)/81], Print[n]], {n, 10^4}]
                    (* 2497 *)
                    (* 3301 *)
                    ...


                    The direct formula for the $n^{text{th}}$ term is from



                    Sum[10^j, {i, 0, n - 1}, {j, 0, i}]
                    (* 1/81 (-10 + 10^(1 + n) - 9 n) *)





                    share|cite|improve this answer









                    $endgroup$



                    The first one is at $n=2497$, you just missed it!



                    Do[If[PrimeQ[(10^(n+1)-9n-10)/81], Print[n]], {n, 10^4}]
                    (* 2497 *)
                    (* 3301 *)
                    ...


                    The direct formula for the $n^{text{th}}$ term is from



                    Sum[10^j, {i, 0, n - 1}, {j, 0, i}]
                    (* 1/81 (-10 + 10^(1 + n) - 9 n) *)






                    share|cite|improve this answer












                    share|cite|improve this answer



                    share|cite|improve this answer










                    answered Jan 28 at 8:01









                    RomanRoman

                    2188




                    2188























                        0












                        $begingroup$

                        To give some more examples of solutions, using Roman's direct formula for conciseness (alternately you can do something like r = 10*r+1; N += r in the loop).



                        Pari/GP (test is AES BPSW):



                        ? for(n=1,6000,ispseudoprime((10^(n+1)-9*n-10)/81) && print(n))
                        2497
                        3301
                        time = 2min, 5,916 ms.


                        Perl/ntheory (v0.74) (test is ES BPSW):



                        $ time perl -Mntheory=:all -E 'is_prob_prime(divint(powint(10,$_+1)-9*$_-10,81)) and say for 1..6000;'
                        2497
                        3301
                        real 0m44.473s


                        PFGW (test is base 3 Fermat):



                        $ echo -e "ABC2 (10^($a+1)-9*$a-10)/81na: from 1 to 6000" > repsum.txt
                        $
                        time ./pfgw64 -k -u0 -f50 repsum.txt
                        (10^(2497+1)-9*2497-10)/81 is 3-PRP! (0.0793s+0.0362s)
                        (10^(3301+1)-9*3301-10)/81 is 3-PRP! (0.1333s+0.0615s)
                        real 0m42.963s


                        As the size gets larger, PFGW will get much faster relative to the others. E.g. times on Macbook Pro (2015) for checking n from 6001 to 7000 the times are 88.9s for Pari/GP, 26.0s for Perl/ntheory, and 13.4s for PFGW. Albeit for any discovered values we'd want to run another more strict test such as BPSW.






                        share|cite|improve this answer









                        $endgroup$


















                          0












                          $begingroup$

                          To give some more examples of solutions, using Roman's direct formula for conciseness (alternately you can do something like r = 10*r+1; N += r in the loop).



                          Pari/GP (test is AES BPSW):



                          ? for(n=1,6000,ispseudoprime((10^(n+1)-9*n-10)/81) && print(n))
                          2497
                          3301
                          time = 2min, 5,916 ms.


                          Perl/ntheory (v0.74) (test is ES BPSW):



                          $ time perl -Mntheory=:all -E 'is_prob_prime(divint(powint(10,$_+1)-9*$_-10,81)) and say for 1..6000;'
                          2497
                          3301
                          real 0m44.473s


                          PFGW (test is base 3 Fermat):



                          $ echo -e "ABC2 (10^($a+1)-9*$a-10)/81na: from 1 to 6000" > repsum.txt
                          $
                          time ./pfgw64 -k -u0 -f50 repsum.txt
                          (10^(2497+1)-9*2497-10)/81 is 3-PRP! (0.0793s+0.0362s)
                          (10^(3301+1)-9*3301-10)/81 is 3-PRP! (0.1333s+0.0615s)
                          real 0m42.963s


                          As the size gets larger, PFGW will get much faster relative to the others. E.g. times on Macbook Pro (2015) for checking n from 6001 to 7000 the times are 88.9s for Pari/GP, 26.0s for Perl/ntheory, and 13.4s for PFGW. Albeit for any discovered values we'd want to run another more strict test such as BPSW.






                          share|cite|improve this answer









                          $endgroup$
















                            0












                            0








                            0





                            $begingroup$

                            To give some more examples of solutions, using Roman's direct formula for conciseness (alternately you can do something like r = 10*r+1; N += r in the loop).



                            Pari/GP (test is AES BPSW):



                            ? for(n=1,6000,ispseudoprime((10^(n+1)-9*n-10)/81) && print(n))
                            2497
                            3301
                            time = 2min, 5,916 ms.


                            Perl/ntheory (v0.74) (test is ES BPSW):



                            $ time perl -Mntheory=:all -E 'is_prob_prime(divint(powint(10,$_+1)-9*$_-10,81)) and say for 1..6000;'
                            2497
                            3301
                            real 0m44.473s


                            PFGW (test is base 3 Fermat):



                            $ echo -e "ABC2 (10^($a+1)-9*$a-10)/81na: from 1 to 6000" > repsum.txt
                            $
                            time ./pfgw64 -k -u0 -f50 repsum.txt
                            (10^(2497+1)-9*2497-10)/81 is 3-PRP! (0.0793s+0.0362s)
                            (10^(3301+1)-9*3301-10)/81 is 3-PRP! (0.1333s+0.0615s)
                            real 0m42.963s


                            As the size gets larger, PFGW will get much faster relative to the others. E.g. times on Macbook Pro (2015) for checking n from 6001 to 7000 the times are 88.9s for Pari/GP, 26.0s for Perl/ntheory, and 13.4s for PFGW. Albeit for any discovered values we'd want to run another more strict test such as BPSW.






                            share|cite|improve this answer









                            $endgroup$



                            To give some more examples of solutions, using Roman's direct formula for conciseness (alternately you can do something like r = 10*r+1; N += r in the loop).



                            Pari/GP (test is AES BPSW):



                            ? for(n=1,6000,ispseudoprime((10^(n+1)-9*n-10)/81) && print(n))
                            2497
                            3301
                            time = 2min, 5,916 ms.


                            Perl/ntheory (v0.74) (test is ES BPSW):



                            $ time perl -Mntheory=:all -E 'is_prob_prime(divint(powint(10,$_+1)-9*$_-10,81)) and say for 1..6000;'
                            2497
                            3301
                            real 0m44.473s


                            PFGW (test is base 3 Fermat):



                            $ echo -e "ABC2 (10^($a+1)-9*$a-10)/81na: from 1 to 6000" > repsum.txt
                            $
                            time ./pfgw64 -k -u0 -f50 repsum.txt
                            (10^(2497+1)-9*2497-10)/81 is 3-PRP! (0.0793s+0.0362s)
                            (10^(3301+1)-9*3301-10)/81 is 3-PRP! (0.1333s+0.0615s)
                            real 0m42.963s


                            As the size gets larger, PFGW will get much faster relative to the others. E.g. times on Macbook Pro (2015) for checking n from 6001 to 7000 the times are 88.9s for Pari/GP, 26.0s for Perl/ntheory, and 13.4s for PFGW. Albeit for any discovered values we'd want to run another more strict test such as BPSW.







                            share|cite|improve this answer












                            share|cite|improve this answer



                            share|cite|improve this answer










                            answered Jan 30 at 0:32









                            DanaJDanaJ

                            2,44211017




                            2,44211017






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Mathematics Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                Use MathJax to format equations. MathJax reference.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3090879%2fprimes-from-the-sum-of-the-first-n-repunits-111111111111111%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                                SQL update select statement

                                'app-layout' is not a known element: how to share Component with different Modules