Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Babbage-problem/JavaScript/babbage-problem-1.js
Normal file
18
Task/Babbage-problem/JavaScript/babbage-problem-1.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Every line starting with a double slash will be ignored by the processing machine,
|
||||
// just like these two.
|
||||
//
|
||||
// Since the square root of 269,696 is approximately 519, we create a variable named "n"
|
||||
// and give it this value.
|
||||
n = 519
|
||||
|
||||
// The while-condition is in parentheses
|
||||
// * is for multiplication
|
||||
// % is for modulo operation
|
||||
// != is for "not equal"
|
||||
while ( ((n * n) % 1000000) != 269696 )
|
||||
n = n + 1
|
||||
|
||||
// n is incremented until the while-condition is met, so n should finally be the
|
||||
// smallest positive integer whose square ends in the digits 269,696. To see n, we
|
||||
// need to send it to the monitoring device (named console).
|
||||
console.log(n)
|
||||
Loading…
Add table
Add a link
Reference in a new issue