Advertisement
Guest User

Math algo

a guest
Jul 22nd, 2024
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using binary representations, first reflect a number at its backside making it into a palindrome. you'll next want to prepare for using elements from look and say, an imaginary cursor, and to make the sequence ur building finish where all the single 1s and 0s are alternating behind the cursor.
  2.  
  3. 1 reflected becomes 11. Now take the cursor to the front and ask how many are in this chunk? Two. We already have 11 and want to append 10 (binary for two) but we must first flip the bits because otherwise we'd mess up the cursor's chunking process. So 01 is appended instead of 10. 1101 and we are finished because from where the cursor is now at (behind 11) everything alternates.
  4.  
  5. 10 reflects to 1001. we have a single 1 which must bit flip to zero. 10010 now the two zeroes can go allow us to append normally 10. 1001010 now behind cursor all 1s and 0s both alternate.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement