Bitwise operations in gimkit

It finds the bit at the nth digit and then adds it to a count. It divides by 2 and floors that to make only 1 and 1 return 1. After that, it adds that sum to the nth digit. The math solution is a bunch of if statements being looped.

2 Likes

This topic is still up and running after like what a months-?

1 Like

Ohhhhh I see haha

1 Like

I mean… there isn’t a solution to it so yeah.

1 Like

It’s been 158 days that a long time -?

1 Like

Wow… Just like me doing 100/7 and not figuring it out so I used two pieces of paper doing long division

1 Like

bump

Yeah rip. No algebraic solutions. Bitwise operations are everything that runs inside the computer. You’d quite literally have to construct a computer in gimkit to do it without recursion lol.

new project acquired :smiley:

1 Like

What project? (I’m still curious what that secret project is lol)

I was making a joke about recreating a computer in gimkit, like with actual computer architecture and not just code.

But for the secret project, it’s… secret. It’s also on hold at the moment, I have a lot of stuff going on.
Schoolwork, Librekit, making an app for a school project, being active here, boy scouts… just a ton of stuff to do lol

3 Likes

Yeah, lots of stuff lately.

question, does anyone know how to replace all 1s in a number with 0?

If so, I might have a solution

Also what are the two numbers-

Is converting them to binary ok?

Set the number to 0.

I mean 45812 to 45802, but with larger numbers and more ones

Any time you need to set all the 1s in a binary number to 0 you get 0 haha

2 Likes

Well my plan was to add the two numbers (binary form) and remove all 1s and replace with 0, then divide 2.

I just had another idea, but it will only work if the sum of the two numbers (binary form) doesn’t have any zeroes.

You could try adding 10^x to add a one to the beginning of the number, subtract the original number from it, then use a string operation to get all digits from the 2nd letter to the last.

Isn’t that… zero?

Nope, because you add a one to the beginning, then you bypass the issue.
419429 becomes 1000000, then you get it as a string from digit 2 to the end, returning 000000. This way it doesn’t simplify to 0.