Ask Your Question
-1

numbers in numbers - divide by 2 - cyclic -algorithm compare

asked 2021-03-12 12:01:54 +0200

Miroslaw gravatar image

We got cyclic of integers divide by 2 in number 2**n. Example:

                                                                        8192 is even number
                                                4096 is even number     4096 is even number
                        2048 is even number     2048 is even number     2048 is even number
    1024 is even number 1024 is even number     1024 is even number     1024 is even number
    512 is even number  512 is even number      512 is even number      512 is even number
    256 is even number  256 is even number      256 is even number      256 is even number
    128 is even number  128 is even number      128 is even number      128 is even number
    64 is even number   64 is even number       64 is even number       64 is even number
    32 is even number   32 is even number       32 is even number       32 is even number
    16 is even number   16 is even number       16 is even number       16 is even number
    8 is even number    8 is even number        8 is even number        8 is even number
    4 is even number    4 is even number        4 is even number        4 is even
   2 is even number     2 is even number        2 is even number        2 is even number
   1 is odd number      1 is odd number         1 is odd number         1 is odd number

second example number:

**8186 is even number       40930 is even number
4093 is odd number      20465 is odd number
4092 is even number     20464 is even number
2046 is even number     10232 is even number
1023 is odd number      5116 is even number
1022 is even number     2558 is even number
511 is odd number       1279 is odd number
510 is even number      1278 is even number
255 is odd number       639 is odd number
254 is even number      638 is even number
127 is odd number       319 is odd number
126 is even number      318 is even number
63 is odd number        159 is odd number
62 is even number       158 is even number
31 is odd number        79 is odd number
30 is even number       78 is even number
15 is odd number        39 is odd number
14 is even number       38 is even number
7 is odd number         19 is odd number
6 is even number        18 is even number
3 is odd number         9 is odd number
2 is even number        8 is even number**
1 is odd number         4 is even number
                        2 is even number
                        1 is odd number

how to analyze ciclic of divide number ? or how many ciclic are ?I mean I wuold like to perfom algorithm which will be detect probality divide number without knowing the number. it is cripto task.
for example we know that Point(X,Y) can be odd like 1,3,5,7,9 or even like 2,4,6,8, depends is odd we must substract 1 to get even, but if even we can divide 2. it must be analyze possibilities.

edit retag flag offensive close merge delete

Comments

It is homework ?

tmonteil gravatar imagetmonteil ( 2021-03-12 12:25:29 +0200 )edit

yes. and I'm stuck

Miroslaw gravatar imageMiroslaw ( 2021-03-12 12:35:39 +0200 )edit
1

Your question is too vague. What probability are you using on the set of integers ?

tmonteil gravatar imagetmonteil ( 2021-03-12 13:51:39 +0200 )edit

i'm looking the answer for question how many sequences with low numbers are included in big numbers. example how similiar is divide numbers from 2**128 regarding to numbers from 2**32 or 2**16. how to mapping possibilities? second example :

2**200 = 1606938044258990275541962092341162602522202993782792835301376L
2**100 = 1267650600228229401496703205376L
2**200 divide by 2**100 = 1267650600228229401496703205376L

is that means that beetween 2**200 and 2**100 we have the same divide algorithms for numbers? because 2**100 is included in 2**200 exactly 2**100 times?
Miroslaw gravatar imageMiroslaw ( 2021-03-12 14:29:13 +0200 )edit

I also have trouble understanding your question. What is given and what you need to compute?

Max Alekseyev gravatar imageMax Alekseyev ( 2021-03-12 17:45:58 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-12 12:35:46 +0200

tmonteil gravatar image

I am not sure about your precise question. Here is some hint anyway:

If you write your number in base 2, the last digit tells you whether the number is even (it is a "0"), or odd (it is a "1").

Now, if your number is even, dividing by 2 corresponds to removing the last "0".

If your number is odd, removing 1 corresponds to replacing the last "1" by a "0".

Hence, to reach 0 from your initial number n, the number of time you will get an odd number in your procedure is the number of "1" in the binary representation of your number n, and the number of time you will get an even number in your procedure is the length of the binary representation of your number n minus 1 (note that the binary representation of 0 has length 1).

Let us consider your last example:

sage: n = 40930
sage: s = n.str(base=2)
sage: s
'1001111111100010'
sage: s.count('1')
10
sage: len(s) - 1
15

Hence, in your procedure, you will have to remove 10 times a 1, and you will have to divide by 2 15 times to reach the number 0.

edit flag offensive delete link more

Comments

Yes that correct, but only when we know the "n", algorithm must work without "n" becouse we know only (X,Y) of "n" where "n" is a integer, algorithm must analyze possibilites that "n" is even or ord and trying to perform calculate. I need to find maximum ciclic of divides. i dont know how to better explain. this must be example everse of creating Point(X,Y) on the curve. too dificult , and i ask for help

Miroslaw gravatar imageMiroslaw ( 2021-03-12 12:44:03 +0200 )edit

You can make arbitrarily long sequences : iy you take 2^100 you will get 100 divisons by 2. Iy you take 2^100-1 you will get 99 divisions by 2 and 99 removal of 1.

tmonteil gravatar imagetmonteil ( 2021-03-12 13:53:03 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-03-12 12:01:54 +0200

Seen: 47 times

Last updated: Mar 12