Equation to locate a square in a square












0












$begingroup$


Good evening,



I have been experimenting with different Sudoku checker and have come across a problem:



For a nxn Sudoku where n is a square number (4,6,19,25 etcc.), there would be an n number of sub-squares in a square. For example for a 9 by 9 there are 9 3x3 equal sized sub squares:



enter image description here



let column = j



let row = i



Now what I am trying to do is to come up with an equation in terms of n and sub-square number needed such that it would equal the first row number.



e.g for sub square number 3 the first row is number 3, for sub square 0 first row is 0 etc.



the issue with this is that the sub squares 0,1 and 2 all start at the same row 0 and therefore does this mean it is impossible to find an equation/algorithm or any other way to do this?



would the same apply for columns for sub squares?










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    Good evening,



    I have been experimenting with different Sudoku checker and have come across a problem:



    For a nxn Sudoku where n is a square number (4,6,19,25 etcc.), there would be an n number of sub-squares in a square. For example for a 9 by 9 there are 9 3x3 equal sized sub squares:



    enter image description here



    let column = j



    let row = i



    Now what I am trying to do is to come up with an equation in terms of n and sub-square number needed such that it would equal the first row number.



    e.g for sub square number 3 the first row is number 3, for sub square 0 first row is 0 etc.



    the issue with this is that the sub squares 0,1 and 2 all start at the same row 0 and therefore does this mean it is impossible to find an equation/algorithm or any other way to do this?



    would the same apply for columns for sub squares?










    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      Good evening,



      I have been experimenting with different Sudoku checker and have come across a problem:



      For a nxn Sudoku where n is a square number (4,6,19,25 etcc.), there would be an n number of sub-squares in a square. For example for a 9 by 9 there are 9 3x3 equal sized sub squares:



      enter image description here



      let column = j



      let row = i



      Now what I am trying to do is to come up with an equation in terms of n and sub-square number needed such that it would equal the first row number.



      e.g for sub square number 3 the first row is number 3, for sub square 0 first row is 0 etc.



      the issue with this is that the sub squares 0,1 and 2 all start at the same row 0 and therefore does this mean it is impossible to find an equation/algorithm or any other way to do this?



      would the same apply for columns for sub squares?










      share|cite|improve this question









      $endgroup$




      Good evening,



      I have been experimenting with different Sudoku checker and have come across a problem:



      For a nxn Sudoku where n is a square number (4,6,19,25 etcc.), there would be an n number of sub-squares in a square. For example for a 9 by 9 there are 9 3x3 equal sized sub squares:



      enter image description here



      let column = j



      let row = i



      Now what I am trying to do is to come up with an equation in terms of n and sub-square number needed such that it would equal the first row number.



      e.g for sub square number 3 the first row is number 3, for sub square 0 first row is 0 etc.



      the issue with this is that the sub squares 0,1 and 2 all start at the same row 0 and therefore does this mean it is impossible to find an equation/algorithm or any other way to do this?



      would the same apply for columns for sub squares?







      recreational-mathematics problem-solving sudoku






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Jan 1 at 23:16









      fredfred

      162




      162






















          2 Answers
          2






          active

          oldest

          votes


















          1












          $begingroup$

          In your example, square $k$ is in row $lfloor frac k3 rfloor$ and in column $k bmod 3$. For general $n$, replace $3$ by $n$. This shows the nice side of counting starting with zero.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Note that calculating $lfloorfrac{k}3rfloor$ in most programming languages simply requires the statement $x:=k/3;$ and $kmbox{ mod }3$ requires $x:=k%3$.
            $endgroup$
            – SmileyCraft
            Jan 1 at 23:20












          • $begingroup$
            Thank you for your response. To clarify by square do you mean each small square that hold 1 number or a sub-square which holds n numbers?
            $endgroup$
            – fred
            Jan 1 at 23:29










          • $begingroup$
            For either case, I am not exactly sure if this would work unless I am mistaken (let me know if I am!). For example if we take subsquare 8 and we do 8/3 we get the 2.66..th row.
            $endgroup$
            – fred
            Jan 1 at 23:33










          • $begingroup$
            I may not have made it clear with the picture my apologies! the lines I drew are the outlines of the square and sub squares not the rows and columns.
            $endgroup$
            – fred
            Jan 1 at 23:36










          • $begingroup$
            I assumed the rows and columns were numbered $0$ to $2$ in each direction.
            $endgroup$
            – Ross Millikan
            Jan 1 at 23:47



















          0












          $begingroup$

          Assuming the rows and columns are the numbers you wrote outside the square: If $n=m^2$ then the first row in the $k$'th sub-square would be row $m cdotlfloor frac{k}{m} rfloor$ (notice the floor function) and the first column would be $m cdot (k bmod m)$.



          So for $n=9$ the first row in e.g. the $7$'th sub-square would be row $3 cdotlfloor frac{7}{3} rfloor = 6$ and the first column would be $3 cdot (7 bmod 3)=3$.






          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%2f3058972%2fequation-to-locate-a-square-in-a-square%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









            1












            $begingroup$

            In your example, square $k$ is in row $lfloor frac k3 rfloor$ and in column $k bmod 3$. For general $n$, replace $3$ by $n$. This shows the nice side of counting starting with zero.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              Note that calculating $lfloorfrac{k}3rfloor$ in most programming languages simply requires the statement $x:=k/3;$ and $kmbox{ mod }3$ requires $x:=k%3$.
              $endgroup$
              – SmileyCraft
              Jan 1 at 23:20












            • $begingroup$
              Thank you for your response. To clarify by square do you mean each small square that hold 1 number or a sub-square which holds n numbers?
              $endgroup$
              – fred
              Jan 1 at 23:29










            • $begingroup$
              For either case, I am not exactly sure if this would work unless I am mistaken (let me know if I am!). For example if we take subsquare 8 and we do 8/3 we get the 2.66..th row.
              $endgroup$
              – fred
              Jan 1 at 23:33










            • $begingroup$
              I may not have made it clear with the picture my apologies! the lines I drew are the outlines of the square and sub squares not the rows and columns.
              $endgroup$
              – fred
              Jan 1 at 23:36










            • $begingroup$
              I assumed the rows and columns were numbered $0$ to $2$ in each direction.
              $endgroup$
              – Ross Millikan
              Jan 1 at 23:47
















            1












            $begingroup$

            In your example, square $k$ is in row $lfloor frac k3 rfloor$ and in column $k bmod 3$. For general $n$, replace $3$ by $n$. This shows the nice side of counting starting with zero.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              Note that calculating $lfloorfrac{k}3rfloor$ in most programming languages simply requires the statement $x:=k/3;$ and $kmbox{ mod }3$ requires $x:=k%3$.
              $endgroup$
              – SmileyCraft
              Jan 1 at 23:20












            • $begingroup$
              Thank you for your response. To clarify by square do you mean each small square that hold 1 number or a sub-square which holds n numbers?
              $endgroup$
              – fred
              Jan 1 at 23:29










            • $begingroup$
              For either case, I am not exactly sure if this would work unless I am mistaken (let me know if I am!). For example if we take subsquare 8 and we do 8/3 we get the 2.66..th row.
              $endgroup$
              – fred
              Jan 1 at 23:33










            • $begingroup$
              I may not have made it clear with the picture my apologies! the lines I drew are the outlines of the square and sub squares not the rows and columns.
              $endgroup$
              – fred
              Jan 1 at 23:36










            • $begingroup$
              I assumed the rows and columns were numbered $0$ to $2$ in each direction.
              $endgroup$
              – Ross Millikan
              Jan 1 at 23:47














            1












            1








            1





            $begingroup$

            In your example, square $k$ is in row $lfloor frac k3 rfloor$ and in column $k bmod 3$. For general $n$, replace $3$ by $n$. This shows the nice side of counting starting with zero.






            share|cite|improve this answer









            $endgroup$



            In your example, square $k$ is in row $lfloor frac k3 rfloor$ and in column $k bmod 3$. For general $n$, replace $3$ by $n$. This shows the nice side of counting starting with zero.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Jan 1 at 23:19









            Ross MillikanRoss Millikan

            294k23198371




            294k23198371












            • $begingroup$
              Note that calculating $lfloorfrac{k}3rfloor$ in most programming languages simply requires the statement $x:=k/3;$ and $kmbox{ mod }3$ requires $x:=k%3$.
              $endgroup$
              – SmileyCraft
              Jan 1 at 23:20












            • $begingroup$
              Thank you for your response. To clarify by square do you mean each small square that hold 1 number or a sub-square which holds n numbers?
              $endgroup$
              – fred
              Jan 1 at 23:29










            • $begingroup$
              For either case, I am not exactly sure if this would work unless I am mistaken (let me know if I am!). For example if we take subsquare 8 and we do 8/3 we get the 2.66..th row.
              $endgroup$
              – fred
              Jan 1 at 23:33










            • $begingroup$
              I may not have made it clear with the picture my apologies! the lines I drew are the outlines of the square and sub squares not the rows and columns.
              $endgroup$
              – fred
              Jan 1 at 23:36










            • $begingroup$
              I assumed the rows and columns were numbered $0$ to $2$ in each direction.
              $endgroup$
              – Ross Millikan
              Jan 1 at 23:47


















            • $begingroup$
              Note that calculating $lfloorfrac{k}3rfloor$ in most programming languages simply requires the statement $x:=k/3;$ and $kmbox{ mod }3$ requires $x:=k%3$.
              $endgroup$
              – SmileyCraft
              Jan 1 at 23:20












            • $begingroup$
              Thank you for your response. To clarify by square do you mean each small square that hold 1 number or a sub-square which holds n numbers?
              $endgroup$
              – fred
              Jan 1 at 23:29










            • $begingroup$
              For either case, I am not exactly sure if this would work unless I am mistaken (let me know if I am!). For example if we take subsquare 8 and we do 8/3 we get the 2.66..th row.
              $endgroup$
              – fred
              Jan 1 at 23:33










            • $begingroup$
              I may not have made it clear with the picture my apologies! the lines I drew are the outlines of the square and sub squares not the rows and columns.
              $endgroup$
              – fred
              Jan 1 at 23:36










            • $begingroup$
              I assumed the rows and columns were numbered $0$ to $2$ in each direction.
              $endgroup$
              – Ross Millikan
              Jan 1 at 23:47
















            $begingroup$
            Note that calculating $lfloorfrac{k}3rfloor$ in most programming languages simply requires the statement $x:=k/3;$ and $kmbox{ mod }3$ requires $x:=k%3$.
            $endgroup$
            – SmileyCraft
            Jan 1 at 23:20






            $begingroup$
            Note that calculating $lfloorfrac{k}3rfloor$ in most programming languages simply requires the statement $x:=k/3;$ and $kmbox{ mod }3$ requires $x:=k%3$.
            $endgroup$
            – SmileyCraft
            Jan 1 at 23:20














            $begingroup$
            Thank you for your response. To clarify by square do you mean each small square that hold 1 number or a sub-square which holds n numbers?
            $endgroup$
            – fred
            Jan 1 at 23:29




            $begingroup$
            Thank you for your response. To clarify by square do you mean each small square that hold 1 number or a sub-square which holds n numbers?
            $endgroup$
            – fred
            Jan 1 at 23:29












            $begingroup$
            For either case, I am not exactly sure if this would work unless I am mistaken (let me know if I am!). For example if we take subsquare 8 and we do 8/3 we get the 2.66..th row.
            $endgroup$
            – fred
            Jan 1 at 23:33




            $begingroup$
            For either case, I am not exactly sure if this would work unless I am mistaken (let me know if I am!). For example if we take subsquare 8 and we do 8/3 we get the 2.66..th row.
            $endgroup$
            – fred
            Jan 1 at 23:33












            $begingroup$
            I may not have made it clear with the picture my apologies! the lines I drew are the outlines of the square and sub squares not the rows and columns.
            $endgroup$
            – fred
            Jan 1 at 23:36




            $begingroup$
            I may not have made it clear with the picture my apologies! the lines I drew are the outlines of the square and sub squares not the rows and columns.
            $endgroup$
            – fred
            Jan 1 at 23:36












            $begingroup$
            I assumed the rows and columns were numbered $0$ to $2$ in each direction.
            $endgroup$
            – Ross Millikan
            Jan 1 at 23:47




            $begingroup$
            I assumed the rows and columns were numbered $0$ to $2$ in each direction.
            $endgroup$
            – Ross Millikan
            Jan 1 at 23:47











            0












            $begingroup$

            Assuming the rows and columns are the numbers you wrote outside the square: If $n=m^2$ then the first row in the $k$'th sub-square would be row $m cdotlfloor frac{k}{m} rfloor$ (notice the floor function) and the first column would be $m cdot (k bmod m)$.



            So for $n=9$ the first row in e.g. the $7$'th sub-square would be row $3 cdotlfloor frac{7}{3} rfloor = 6$ and the first column would be $3 cdot (7 bmod 3)=3$.






            share|cite|improve this answer









            $endgroup$


















              0












              $begingroup$

              Assuming the rows and columns are the numbers you wrote outside the square: If $n=m^2$ then the first row in the $k$'th sub-square would be row $m cdotlfloor frac{k}{m} rfloor$ (notice the floor function) and the first column would be $m cdot (k bmod m)$.



              So for $n=9$ the first row in e.g. the $7$'th sub-square would be row $3 cdotlfloor frac{7}{3} rfloor = 6$ and the first column would be $3 cdot (7 bmod 3)=3$.






              share|cite|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                Assuming the rows and columns are the numbers you wrote outside the square: If $n=m^2$ then the first row in the $k$'th sub-square would be row $m cdotlfloor frac{k}{m} rfloor$ (notice the floor function) and the first column would be $m cdot (k bmod m)$.



                So for $n=9$ the first row in e.g. the $7$'th sub-square would be row $3 cdotlfloor frac{7}{3} rfloor = 6$ and the first column would be $3 cdot (7 bmod 3)=3$.






                share|cite|improve this answer









                $endgroup$



                Assuming the rows and columns are the numbers you wrote outside the square: If $n=m^2$ then the first row in the $k$'th sub-square would be row $m cdotlfloor frac{k}{m} rfloor$ (notice the floor function) and the first column would be $m cdot (k bmod m)$.



                So for $n=9$ the first row in e.g. the $7$'th sub-square would be row $3 cdotlfloor frac{7}{3} rfloor = 6$ and the first column would be $3 cdot (7 bmod 3)=3$.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Jan 2 at 1:53









                JensJens

                3,71521030




                3,71521030






























                    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%2f3058972%2fequation-to-locate-a-square-in-a-square%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

                    Human spaceflight

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                    File:DeusFollowingSea.jpg