# Does anyone know how to make modular arithmetic with block code?

This is for my new top secret thing I’m working on.

2 Likes

what’s modular arithmetic

It’s this

Yeah, there should be some code for that.

Use the floor block and some division for that. Here’s an example:

7 Likes

Can you explain that?

1 Like

1 Like

Math words to big. Me confuzzeled

1 Like

The mod function takes the remainder when you divide m by n. First, it divides m by n. It then takes the floor of the result (greatest integer below it) and subtracts that from the result. After that, you have the remainder divided by n. So then you multiply by n again to get just the remainder.

1 Like

Modular Arithmetic isn’t really something you learn in a typical math class I think so yeah…

3 Likes

I don’t understand JavaScript, I’m a python person.

1 Like

Well the javascript part doesn’t matter, you really only need to to understand the english and tune out the javascript.

1 Like

2 Likes

That’s with datatype conversions though… I don’t know about double to int conversions in gimkit…

Just notices the english. Okay!

I’ll mark a solution after I make it in GKC.

Yes it is! I was taught that stuff in fourth grade! (We were never taught how to make it in code though)

Different educations, I guess. I was also focusing on the middle-high school real courses like (algebra 1, precalculus, etc.)

Well everyone used to know that in third grade !(thanks khan academy)