How many times was a 8 digit binary number circulary shifted? [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-1
down vote

favorite












Given an 8 digit binary number for example: $ 00000111 $, and the same number circularly shifted $k$ times, where $k < 8$, $ 11000001 $ can i calculate k without curcularly shifting the original number until it matches the second one?







share|cite|improve this question













closed as off-topic by amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080 Jul 16 at 10:29


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080
If this question can be reworded to fit the rules in the help center, please edit the question.
















    up vote
    -1
    down vote

    favorite












    Given an 8 digit binary number for example: $ 00000111 $, and the same number circularly shifted $k$ times, where $k < 8$, $ 11000001 $ can i calculate k without curcularly shifting the original number until it matches the second one?







    share|cite|improve this question













    closed as off-topic by amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080 Jul 16 at 10:29


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080
    If this question can be reworded to fit the rules in the help center, please edit the question.














      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      Given an 8 digit binary number for example: $ 00000111 $, and the same number circularly shifted $k$ times, where $k < 8$, $ 11000001 $ can i calculate k without curcularly shifting the original number until it matches the second one?







      share|cite|improve this question













      Given an 8 digit binary number for example: $ 00000111 $, and the same number circularly shifted $k$ times, where $k < 8$, $ 11000001 $ can i calculate k without curcularly shifting the original number until it matches the second one?









      share|cite|improve this question












      share|cite|improve this question




      share|cite|improve this question








      edited Jul 15 at 18:05
























      asked Jul 15 at 17:42









      Kratos

      12




      12




      closed as off-topic by amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080 Jul 16 at 10:29


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080
      If this question can be reworded to fit the rules in the help center, please edit the question.




      closed as off-topic by amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080 Jul 16 at 10:29


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – amWhy, Xander Henderson, Leucippus, Parcly Taxel, user190080
      If this question can be reworded to fit the rules in the help center, please edit the question.




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          You can't calculate $k$ at all, even by circularly shifting. Suppose you shifted it $j$ times (for some $jin0,1,2,3,4,5,6,7$ to get the original number. Then for any nonnegative integer $n,$ shifting the original number $8n-j$ times looks exactly the same as it would for any other such $n.$



          The best you can do is calculate $k$ modulo $8.$



          Edit: Even if you know that $kin1,2,3,4,5,6,7$ you can't necessarily do any better. Consider the number $10101010$ to see why.






          share|cite|improve this answer























          • Oh you're right, I'll rephrase my question. I should've said that $k le 8$. Thanks.
            – Kratos
            Jul 15 at 17:59










          • @Kratos: Unfortunately, that still doesn't allow you to do the job in general. See my edited answer.
            – Cameron Buie
            Jul 15 at 18:02










          • I'm so dumb. Is there a way to calculate if k is odd or even?
            – Kratos
            Jul 15 at 18:10

















          up vote
          1
          down vote













          If you happen to start from 0101010101, you are out of luck because you cannot possible distinguish between $k=2$ and $k=0$ (and many more).
          But if we assume that the original pattern has not periodic at all, the following works without trial shifting:



          Note that circular shifting $a$ is equivalent to computing $2abmod 255$ (we exclude the case of $a=255$ here). Hence we are given $2^kabmod 255$ and want to find $k$. By assumption, $a$ is not a multiple of $17$ (or else the two half-bytes would be equal). Hence we can compute $a^-1bmod 17$ and hence $2^kbmod 17$. From this compute $k$ via lookup:
          $$beginmatrix
          2^k&1&2&4&8&9&13&15&16\
          k&0&1&2&3&7&6&5&4endmatrix $$






          share|cite|improve this answer




























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted










            You can't calculate $k$ at all, even by circularly shifting. Suppose you shifted it $j$ times (for some $jin0,1,2,3,4,5,6,7$ to get the original number. Then for any nonnegative integer $n,$ shifting the original number $8n-j$ times looks exactly the same as it would for any other such $n.$



            The best you can do is calculate $k$ modulo $8.$



            Edit: Even if you know that $kin1,2,3,4,5,6,7$ you can't necessarily do any better. Consider the number $10101010$ to see why.






            share|cite|improve this answer























            • Oh you're right, I'll rephrase my question. I should've said that $k le 8$. Thanks.
              – Kratos
              Jul 15 at 17:59










            • @Kratos: Unfortunately, that still doesn't allow you to do the job in general. See my edited answer.
              – Cameron Buie
              Jul 15 at 18:02










            • I'm so dumb. Is there a way to calculate if k is odd or even?
              – Kratos
              Jul 15 at 18:10














            up vote
            0
            down vote



            accepted










            You can't calculate $k$ at all, even by circularly shifting. Suppose you shifted it $j$ times (for some $jin0,1,2,3,4,5,6,7$ to get the original number. Then for any nonnegative integer $n,$ shifting the original number $8n-j$ times looks exactly the same as it would for any other such $n.$



            The best you can do is calculate $k$ modulo $8.$



            Edit: Even if you know that $kin1,2,3,4,5,6,7$ you can't necessarily do any better. Consider the number $10101010$ to see why.






            share|cite|improve this answer























            • Oh you're right, I'll rephrase my question. I should've said that $k le 8$. Thanks.
              – Kratos
              Jul 15 at 17:59










            • @Kratos: Unfortunately, that still doesn't allow you to do the job in general. See my edited answer.
              – Cameron Buie
              Jul 15 at 18:02










            • I'm so dumb. Is there a way to calculate if k is odd or even?
              – Kratos
              Jul 15 at 18:10












            up vote
            0
            down vote



            accepted







            up vote
            0
            down vote



            accepted






            You can't calculate $k$ at all, even by circularly shifting. Suppose you shifted it $j$ times (for some $jin0,1,2,3,4,5,6,7$ to get the original number. Then for any nonnegative integer $n,$ shifting the original number $8n-j$ times looks exactly the same as it would for any other such $n.$



            The best you can do is calculate $k$ modulo $8.$



            Edit: Even if you know that $kin1,2,3,4,5,6,7$ you can't necessarily do any better. Consider the number $10101010$ to see why.






            share|cite|improve this answer















            You can't calculate $k$ at all, even by circularly shifting. Suppose you shifted it $j$ times (for some $jin0,1,2,3,4,5,6,7$ to get the original number. Then for any nonnegative integer $n,$ shifting the original number $8n-j$ times looks exactly the same as it would for any other such $n.$



            The best you can do is calculate $k$ modulo $8.$



            Edit: Even if you know that $kin1,2,3,4,5,6,7$ you can't necessarily do any better. Consider the number $10101010$ to see why.







            share|cite|improve this answer















            share|cite|improve this answer



            share|cite|improve this answer








            edited Jul 15 at 18:01


























            answered Jul 15 at 17:46









            Cameron Buie

            83.5k771153




            83.5k771153











            • Oh you're right, I'll rephrase my question. I should've said that $k le 8$. Thanks.
              – Kratos
              Jul 15 at 17:59










            • @Kratos: Unfortunately, that still doesn't allow you to do the job in general. See my edited answer.
              – Cameron Buie
              Jul 15 at 18:02










            • I'm so dumb. Is there a way to calculate if k is odd or even?
              – Kratos
              Jul 15 at 18:10
















            • Oh you're right, I'll rephrase my question. I should've said that $k le 8$. Thanks.
              – Kratos
              Jul 15 at 17:59










            • @Kratos: Unfortunately, that still doesn't allow you to do the job in general. See my edited answer.
              – Cameron Buie
              Jul 15 at 18:02










            • I'm so dumb. Is there a way to calculate if k is odd or even?
              – Kratos
              Jul 15 at 18:10















            Oh you're right, I'll rephrase my question. I should've said that $k le 8$. Thanks.
            – Kratos
            Jul 15 at 17:59




            Oh you're right, I'll rephrase my question. I should've said that $k le 8$. Thanks.
            – Kratos
            Jul 15 at 17:59












            @Kratos: Unfortunately, that still doesn't allow you to do the job in general. See my edited answer.
            – Cameron Buie
            Jul 15 at 18:02




            @Kratos: Unfortunately, that still doesn't allow you to do the job in general. See my edited answer.
            – Cameron Buie
            Jul 15 at 18:02












            I'm so dumb. Is there a way to calculate if k is odd or even?
            – Kratos
            Jul 15 at 18:10




            I'm so dumb. Is there a way to calculate if k is odd or even?
            – Kratos
            Jul 15 at 18:10










            up vote
            1
            down vote













            If you happen to start from 0101010101, you are out of luck because you cannot possible distinguish between $k=2$ and $k=0$ (and many more).
            But if we assume that the original pattern has not periodic at all, the following works without trial shifting:



            Note that circular shifting $a$ is equivalent to computing $2abmod 255$ (we exclude the case of $a=255$ here). Hence we are given $2^kabmod 255$ and want to find $k$. By assumption, $a$ is not a multiple of $17$ (or else the two half-bytes would be equal). Hence we can compute $a^-1bmod 17$ and hence $2^kbmod 17$. From this compute $k$ via lookup:
            $$beginmatrix
            2^k&1&2&4&8&9&13&15&16\
            k&0&1&2&3&7&6&5&4endmatrix $$






            share|cite|improve this answer

























              up vote
              1
              down vote













              If you happen to start from 0101010101, you are out of luck because you cannot possible distinguish between $k=2$ and $k=0$ (and many more).
              But if we assume that the original pattern has not periodic at all, the following works without trial shifting:



              Note that circular shifting $a$ is equivalent to computing $2abmod 255$ (we exclude the case of $a=255$ here). Hence we are given $2^kabmod 255$ and want to find $k$. By assumption, $a$ is not a multiple of $17$ (or else the two half-bytes would be equal). Hence we can compute $a^-1bmod 17$ and hence $2^kbmod 17$. From this compute $k$ via lookup:
              $$beginmatrix
              2^k&1&2&4&8&9&13&15&16\
              k&0&1&2&3&7&6&5&4endmatrix $$






              share|cite|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                If you happen to start from 0101010101, you are out of luck because you cannot possible distinguish between $k=2$ and $k=0$ (and many more).
                But if we assume that the original pattern has not periodic at all, the following works without trial shifting:



                Note that circular shifting $a$ is equivalent to computing $2abmod 255$ (we exclude the case of $a=255$ here). Hence we are given $2^kabmod 255$ and want to find $k$. By assumption, $a$ is not a multiple of $17$ (or else the two half-bytes would be equal). Hence we can compute $a^-1bmod 17$ and hence $2^kbmod 17$. From this compute $k$ via lookup:
                $$beginmatrix
                2^k&1&2&4&8&9&13&15&16\
                k&0&1&2&3&7&6&5&4endmatrix $$






                share|cite|improve this answer













                If you happen to start from 0101010101, you are out of luck because you cannot possible distinguish between $k=2$ and $k=0$ (and many more).
                But if we assume that the original pattern has not periodic at all, the following works without trial shifting:



                Note that circular shifting $a$ is equivalent to computing $2abmod 255$ (we exclude the case of $a=255$ here). Hence we are given $2^kabmod 255$ and want to find $k$. By assumption, $a$ is not a multiple of $17$ (or else the two half-bytes would be equal). Hence we can compute $a^-1bmod 17$ and hence $2^kbmod 17$. From this compute $k$ via lookup:
                $$beginmatrix
                2^k&1&2&4&8&9&13&15&16\
                k&0&1&2&3&7&6&5&4endmatrix $$







                share|cite|improve this answer













                share|cite|improve this answer



                share|cite|improve this answer











                answered Jul 15 at 18:07









                Hagen von Eitzen

                265k20258477




                265k20258477












                    Comments

                    Popular posts from this blog

                    What is the equation of a 3D cone with generalised tilt?

                    Color the edges and diagonals of a regular polygon

                    Relationship between determinant of matrix and determinant of adjoint?