Is it possible to find a closed form using modular arithmetic?












1












$begingroup$


Look at this sequence:




$$a_n=left{1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, cdots right}$$




This is a periodic sequence. Repeating block is $left{1, 0, 0, 2right}.$



Here is my closed form:




$$a_n = frac 14((-1)^n + (2 + i) (-i)^n + (2 - i) i^n + 3)$$



where, $i^2=-1$




Is it possible to find a closed form using modular arithmetic?



I mean for example,



$Amod 3+Bmod 4 cdots cdots cdots$



Is it possible?










share|cite|improve this question











$endgroup$

















    1












    $begingroup$


    Look at this sequence:




    $$a_n=left{1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, cdots right}$$




    This is a periodic sequence. Repeating block is $left{1, 0, 0, 2right}.$



    Here is my closed form:




    $$a_n = frac 14((-1)^n + (2 + i) (-i)^n + (2 - i) i^n + 3)$$



    where, $i^2=-1$




    Is it possible to find a closed form using modular arithmetic?



    I mean for example,



    $Amod 3+Bmod 4 cdots cdots cdots$



    Is it possible?










    share|cite|improve this question











    $endgroup$















      1












      1








      1





      $begingroup$


      Look at this sequence:




      $$a_n=left{1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, cdots right}$$




      This is a periodic sequence. Repeating block is $left{1, 0, 0, 2right}.$



      Here is my closed form:




      $$a_n = frac 14((-1)^n + (2 + i) (-i)^n + (2 - i) i^n + 3)$$



      where, $i^2=-1$




      Is it possible to find a closed form using modular arithmetic?



      I mean for example,



      $Amod 3+Bmod 4 cdots cdots cdots$



      Is it possible?










      share|cite|improve this question











      $endgroup$




      Look at this sequence:




      $$a_n=left{1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, cdots right}$$




      This is a periodic sequence. Repeating block is $left{1, 0, 0, 2right}.$



      Here is my closed form:




      $$a_n = frac 14((-1)^n + (2 + i) (-i)^n + (2 - i) i^n + 3)$$



      where, $i^2=-1$




      Is it possible to find a closed form using modular arithmetic?



      I mean for example,



      $Amod 3+Bmod 4 cdots cdots cdots$



      Is it possible?







      sequences-and-series number-theory elementary-number-theory modular-arithmetic closed-form






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Jan 25 at 7:25







      Elementary

















      asked Jan 24 at 23:02









      ElementaryElementary

      360111




      360111






















          2 Answers
          2






          active

          oldest

          votes


















          2












          $begingroup$

          You want a function of $n$ that behaves as follows:



          $f(n) = begin{cases} 1 text{ if } n mod 4 = 1\ 0 text{ if } n mod 4 = 2,3\ 2 text{ if } n mod 4 = 0end{cases}$



          Let's denote $n mod 4$ by $n'$. The polynomial $n'(n'-2)(n'-3)$ is $0$ when $n'=0,2,3$ and takes the value $2$ when $n'=1$. So this suggests



          $frac 1 2 n'(n'-2)(n'-3)$



          should be part of a closed form expression. Similarly $(n'-1)(n'-2)(n'-3)$ is $0$ when $n'=1,2,3$ and takes the value $-6$ when $n'=0$. So this suggests



          $-frac 1 3 (n'-1)(n'-2)(n'-3)$



          should be part of the expression too. So we have



          $f(n) = frac 1 2 n'(n'-2)(n'-3) - frac 1 3 (n'-1)(n'-2)(n'-3)\
          = frac 1 6 (n'+2)(n'-2)(n'-3) \
          = frac 1 6 (n'^3 -3n'^2 -4n'+12) text{ where } n'=nmod 4$






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            That polynomial is the one interpolating $(1,1),(2,0),(3,0),(4,2)$.
            $endgroup$
            – lhf
            Jan 25 at 10:19



















          2












          $begingroup$

          Using modular-arithmetic is quite similar to using floor functions so you can also use that instead. Here is a possible solution:
          $$
          f(n) = frac{1}{6}left((n-4lfloor n/4rfloor)^3 -3(n-4lfloor n/4rfloor)^2 - 4(n-lfloor n/4 rfloor) + 12 right)
          $$

          In this case $n-4lfloor n/4 rfloor$ would be the same as $npmod 4$.






          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%2f3086488%2fis-it-possible-to-find-a-closed-form-using-modular-arithmetic%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2












            $begingroup$

            You want a function of $n$ that behaves as follows:



            $f(n) = begin{cases} 1 text{ if } n mod 4 = 1\ 0 text{ if } n mod 4 = 2,3\ 2 text{ if } n mod 4 = 0end{cases}$



            Let's denote $n mod 4$ by $n'$. The polynomial $n'(n'-2)(n'-3)$ is $0$ when $n'=0,2,3$ and takes the value $2$ when $n'=1$. So this suggests



            $frac 1 2 n'(n'-2)(n'-3)$



            should be part of a closed form expression. Similarly $(n'-1)(n'-2)(n'-3)$ is $0$ when $n'=1,2,3$ and takes the value $-6$ when $n'=0$. So this suggests



            $-frac 1 3 (n'-1)(n'-2)(n'-3)$



            should be part of the expression too. So we have



            $f(n) = frac 1 2 n'(n'-2)(n'-3) - frac 1 3 (n'-1)(n'-2)(n'-3)\
            = frac 1 6 (n'+2)(n'-2)(n'-3) \
            = frac 1 6 (n'^3 -3n'^2 -4n'+12) text{ where } n'=nmod 4$






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              That polynomial is the one interpolating $(1,1),(2,0),(3,0),(4,2)$.
              $endgroup$
              – lhf
              Jan 25 at 10:19
















            2












            $begingroup$

            You want a function of $n$ that behaves as follows:



            $f(n) = begin{cases} 1 text{ if } n mod 4 = 1\ 0 text{ if } n mod 4 = 2,3\ 2 text{ if } n mod 4 = 0end{cases}$



            Let's denote $n mod 4$ by $n'$. The polynomial $n'(n'-2)(n'-3)$ is $0$ when $n'=0,2,3$ and takes the value $2$ when $n'=1$. So this suggests



            $frac 1 2 n'(n'-2)(n'-3)$



            should be part of a closed form expression. Similarly $(n'-1)(n'-2)(n'-3)$ is $0$ when $n'=1,2,3$ and takes the value $-6$ when $n'=0$. So this suggests



            $-frac 1 3 (n'-1)(n'-2)(n'-3)$



            should be part of the expression too. So we have



            $f(n) = frac 1 2 n'(n'-2)(n'-3) - frac 1 3 (n'-1)(n'-2)(n'-3)\
            = frac 1 6 (n'+2)(n'-2)(n'-3) \
            = frac 1 6 (n'^3 -3n'^2 -4n'+12) text{ where } n'=nmod 4$






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              That polynomial is the one interpolating $(1,1),(2,0),(3,0),(4,2)$.
              $endgroup$
              – lhf
              Jan 25 at 10:19














            2












            2








            2





            $begingroup$

            You want a function of $n$ that behaves as follows:



            $f(n) = begin{cases} 1 text{ if } n mod 4 = 1\ 0 text{ if } n mod 4 = 2,3\ 2 text{ if } n mod 4 = 0end{cases}$



            Let's denote $n mod 4$ by $n'$. The polynomial $n'(n'-2)(n'-3)$ is $0$ when $n'=0,2,3$ and takes the value $2$ when $n'=1$. So this suggests



            $frac 1 2 n'(n'-2)(n'-3)$



            should be part of a closed form expression. Similarly $(n'-1)(n'-2)(n'-3)$ is $0$ when $n'=1,2,3$ and takes the value $-6$ when $n'=0$. So this suggests



            $-frac 1 3 (n'-1)(n'-2)(n'-3)$



            should be part of the expression too. So we have



            $f(n) = frac 1 2 n'(n'-2)(n'-3) - frac 1 3 (n'-1)(n'-2)(n'-3)\
            = frac 1 6 (n'+2)(n'-2)(n'-3) \
            = frac 1 6 (n'^3 -3n'^2 -4n'+12) text{ where } n'=nmod 4$






            share|cite|improve this answer









            $endgroup$



            You want a function of $n$ that behaves as follows:



            $f(n) = begin{cases} 1 text{ if } n mod 4 = 1\ 0 text{ if } n mod 4 = 2,3\ 2 text{ if } n mod 4 = 0end{cases}$



            Let's denote $n mod 4$ by $n'$. The polynomial $n'(n'-2)(n'-3)$ is $0$ when $n'=0,2,3$ and takes the value $2$ when $n'=1$. So this suggests



            $frac 1 2 n'(n'-2)(n'-3)$



            should be part of a closed form expression. Similarly $(n'-1)(n'-2)(n'-3)$ is $0$ when $n'=1,2,3$ and takes the value $-6$ when $n'=0$. So this suggests



            $-frac 1 3 (n'-1)(n'-2)(n'-3)$



            should be part of the expression too. So we have



            $f(n) = frac 1 2 n'(n'-2)(n'-3) - frac 1 3 (n'-1)(n'-2)(n'-3)\
            = frac 1 6 (n'+2)(n'-2)(n'-3) \
            = frac 1 6 (n'^3 -3n'^2 -4n'+12) text{ where } n'=nmod 4$







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Jan 25 at 10:16









            gandalf61gandalf61

            9,109825




            9,109825












            • $begingroup$
              That polynomial is the one interpolating $(1,1),(2,0),(3,0),(4,2)$.
              $endgroup$
              – lhf
              Jan 25 at 10:19


















            • $begingroup$
              That polynomial is the one interpolating $(1,1),(2,0),(3,0),(4,2)$.
              $endgroup$
              – lhf
              Jan 25 at 10:19
















            $begingroup$
            That polynomial is the one interpolating $(1,1),(2,0),(3,0),(4,2)$.
            $endgroup$
            – lhf
            Jan 25 at 10:19




            $begingroup$
            That polynomial is the one interpolating $(1,1),(2,0),(3,0),(4,2)$.
            $endgroup$
            – lhf
            Jan 25 at 10:19











            2












            $begingroup$

            Using modular-arithmetic is quite similar to using floor functions so you can also use that instead. Here is a possible solution:
            $$
            f(n) = frac{1}{6}left((n-4lfloor n/4rfloor)^3 -3(n-4lfloor n/4rfloor)^2 - 4(n-lfloor n/4 rfloor) + 12 right)
            $$

            In this case $n-4lfloor n/4 rfloor$ would be the same as $npmod 4$.






            share|cite|improve this answer









            $endgroup$


















              2












              $begingroup$

              Using modular-arithmetic is quite similar to using floor functions so you can also use that instead. Here is a possible solution:
              $$
              f(n) = frac{1}{6}left((n-4lfloor n/4rfloor)^3 -3(n-4lfloor n/4rfloor)^2 - 4(n-lfloor n/4 rfloor) + 12 right)
              $$

              In this case $n-4lfloor n/4 rfloor$ would be the same as $npmod 4$.






              share|cite|improve this answer









              $endgroup$
















                2












                2








                2





                $begingroup$

                Using modular-arithmetic is quite similar to using floor functions so you can also use that instead. Here is a possible solution:
                $$
                f(n) = frac{1}{6}left((n-4lfloor n/4rfloor)^3 -3(n-4lfloor n/4rfloor)^2 - 4(n-lfloor n/4 rfloor) + 12 right)
                $$

                In this case $n-4lfloor n/4 rfloor$ would be the same as $npmod 4$.






                share|cite|improve this answer









                $endgroup$



                Using modular-arithmetic is quite similar to using floor functions so you can also use that instead. Here is a possible solution:
                $$
                f(n) = frac{1}{6}left((n-4lfloor n/4rfloor)^3 -3(n-4lfloor n/4rfloor)^2 - 4(n-lfloor n/4 rfloor) + 12 right)
                $$

                In this case $n-4lfloor n/4 rfloor$ would be the same as $npmod 4$.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Jan 25 at 9:47









                Yong Hao NgYong Hao Ng

                3,6141222




                3,6141222






























                    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%2f3086488%2fis-it-possible-to-find-a-closed-form-using-modular-arithmetic%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

                    MongoDB - Not Authorized To Execute Command

                    How to fix TextFormField cause rebuild widget in Flutter

                    Npm cannot find a required file even through it is in the searched directory