Back
Close

Internal rotation (Part I)

Statement
You will be given a number [[N]]. Convert the number [[N]] to binary and perform rotations in the binary string in the following manner. Assume that the number is {{4971}}. Its binary representation is {{1001101101011}}. Now, for each character in the binary string, rotate the string up to that index [[i]] by [[i]] places to the left. That is, <<1>>001101101011 = 4971 <<01>>01101101011 = 2923 <<001>>1101101011 = 1899 <<1001>>101101011 = 4971 <<11001>>01101011 = 6507 <<011001>>1101011 = 3307 <<1011001>>101011 = 5739 <<11011001>>01011 = 6955 <<011011001>>1011 = 3483 <<1011011001>>011 = 5835 <<01011011001>>11 = 2919 <<101011011001>>1 = 5555 <<1101011011001>> = 6873 Do this till the end of the string and return only the decimal sequence.

Input description
A single integer [[N]]

Output description
Integer Sequence as described above separated by a new line.

Constraints

Game modes
Shortest

Test cases
Test 1 Test
Input
4971
Output
4971 2923 1899 4971 6507 3307 5739 6955 3483 5835 2919 5555 6873

Validator 1 Validator
Input
475855
Output
475855 475855 475855 246479 377551 189135 94927 47823 24271 274127 137167 330703 427471 213743 106879 315583 419935 472111 498199

Test 2 Test
Input
5985445
Output
5985445 3888293 5985445 7034021 3626149 5985445 7165093 3593381 5985445 2995365 5690533 2845861 5616805 2808485 1404325 4896421 2448229 5418405 2709205 1354605 4871605 2435803 5412205

Validator 2 Validator
Input
781524
Output
781524 519380 781524 912596 978132 1010900 1027284 515284 781524 914644 457428 228820 638676 843604 421812 735188 367596 708084 354042 177021

Test 3 Test
Input
45587
Output
45587 29203 45587 53779 27155 13843 39443 19731 9875 4947 2483 34003 17003 8503 37019 51277

Validator 3 Validator
Input
785256
Output
785256 523112 785256 916328 981864 1014632 1031016 1039208 1043304 522088 785256 916840 458472 753512 901032 450520 749544 374772 187386 93693

Test 4 Test
Input
5454547
Output
5454547 3357395 5454547 2833107 1522387 4930259 6634195 3324627 1669843 5028563 6707923 7547603 3774163 6081235 3040723 5714643 7051603 3525811 5957203 2978603 1489303 4938955 6663781

Validator 4 Validator
Input
421584848
Output
421584848 421584848 220258256 119594960 320921552 161538000 81846224 308338640 154197968 77127632 38592464 19324880 9691088 273276880 405069776 202538960 369704912 453287888 495079376 515975120 526422992 531646928 534258896 267129456 402000176 201000088 100500044 50250022 25125011

Test 5 Test
Input
15679827
Output
15679827 15679827 15679827 8339795 12534099 14631251 15679827 16204115 8110419 12435795 6218067 3109203 1554771 777555 388947 8582995 4291539 10534355 5267187 11022195 5511099 2755551 9766383 13271799

Validator 5 Validator
Input
5981
Output
5981 3933 5981 7005 7517 3805 5981 3005 5597 6893 7541 3771 5981

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants