The Lounge is rated PG. If you're about to post something you wouldn't want your
kid sister to read then don't post it. No flame wars, no abusive conduct, no programming
questions and please don't post ads.
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004
There are various ways to solve this of course, but one way could be:
The lowest non-zero shift count is 3, so the top 3 bits are the original bits. The next 3 bits from the top have the top bits XORed into them, and they can be restored by again XORing with the top bits:
x ^= x >> 3;
Now the top 6 bits are decoded, but the rest of the bits are "more tangled up". Proceeding that way does keep making progress because it always makes the decoded part at least 1 bit longer, but as it does so it makes the bottom bits more and more messed up. That's tricky to keep track of just in my mind, so what I would do is represent the current state of "how tangled up" the message is an an ulong (m) that has bit k set iff x is still XORed with the original message shifted right by k. So m = 1 | (1UL << 3) | (1UL << 13) | (1UL << 47) at the start, and when restoring that first group of bits it changes in a similar way: m ^= m << 3;.
The next offset can be found by looking in m for the rightmost set bit apart from the least significant bit, so offset = countTrailingZeros(m & ~1UL). The second offset is 6, then 12, 13, 16, 19, 22, etc.
As a variant, a similar thing can be done but xoring x with shifted versions of the original encoded message instead of the current x, which would be paired with xoring m with shifted versions of the original m instead of the current m. Then the offset sequence is 3, 6, 12, 13, 15, 18, 19, 21...
Or if you immediately see what's going on, you can relate this problem to finding the carryless multiplicative inverse modulo 264, but you didn't need that just to solve the puzzle.
Is that new? Newspapers were never politically aligned liars until The Internet? Universal vote did not exist until The Internet? Cosnpiracy nuts, doomsday preachers and "alternative medicine" enthusiasts did not exist before The Internet?
The Internet came in usage in Italy quite late, in the mid-2000. We had the same share of idiots and idiotic laws all the same.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
Newspapers are worse because they are competing with fake news sites and fighting for survival. My dad used to show me audio tapes of conspiracy theories. They had limited reach and were obviously dodgy. That's no longer true.
Alternative medicine existed all along. I was more talking about conspiracy theories like anti vax, than homoepathy, although it's true that 'natural medicine' also recruits on the web
Politicians have been lying and media has been spreading "fake news" long before the internet, the only difference is the number of people they reach.
At least the internet enables "regular folk" to argue against it.
If the internet has destroyed anything, it's social interaction.
Social media is anything but social and now, neither are we (just the way I like it ).