What's the largest number you can take the modulo from? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the largest number you can take the modulo from?

I know it sounds like I'm trying to be smartass, but I've encountered this problem multiple times when I'm cracking the exercises in discrete maths courses. Or is there no maximum in javascript? And if there is, how does one work his way around the problem?

26th Nov 2016, 12:04 AM
Wout Sartrys
Wout Sartrys - avatar
2 Answers
+ 1
What does the output say when you encounter it? I don't think there's any restriction on it.
26th Nov 2016, 1:02 AM
Ben
Ben - avatar
0
This is a quick mash of code to show you my problem (it's javascript) & in html you should add in the body <div id="demo"></div> //calling the function in window.onload to make sure the HTML is loaded window.onload = function() { //make this var larger than 11 and the problem will show var poweroony = 12; //creating a new paragraph var power = 25**poweroony; var modulo = 7; var p = document.createElement("p"); var node = document.createTextNode("large integer: " + power + "\nmodulo: %" + modulo + "\noutcome: " + power%modulo); p.appendChild(node); var div = document.getElementById("demo"); //adding the paragraph to the div div.appendChild(p); };
26th Nov 2016, 5:54 PM
Wout Sartrys
Wout Sartrys - avatar