Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
64 lines (47 loc) · 1015 Bytes

File metadata and controls

64 lines (47 loc) · 1015 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
<head>
<script>
function problem1(){
var sum = 0;
for (i = 2; i < 1000; ++i) {
if((i % 3 ===0) || (i % 5 === 0)) {
sum += i;
}
}
alert("The sum of multiples of 3 and 5 below 1000 is " + sum + ".");
}
function problem2(){
var firsnum = 1;
var secnum = 2;
var sum = firsnum + secnum;
var totalSum=0;
while(sum < 4000000) {
if(sum % 2 === 0){
totalSum += sum;
}
firsnum = secnum;
secnum = sum;
sum = firsnum + secnum;
}
alert("The sum of the total even numbers in the Fibonacci sequence is " + totalSum + ".");
}
function problem3() {
var x = 600851475143;
var b = x;
var i = 2;
while (i < b) {
while (b % i === 0) {
(function(z) {
b = z;
})
(b/i)
}
i++
}
alert("The largest prime factor of 600851475143 is equal to " + b + ".")
}
</script>
<button onclick="problem1()">Problem 1</button>
<button onclick="problem2()">Problem 2</button>
<button onclick="problem3()">Problem 3</button>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.