You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this.postMessage("<b>Primes are integers greater than one with no positive divisors besides one and itself. Please enter a number >= 2.</br>Reload to continue...</b>");
11
+
},300);
12
+
firstMessagePostCompleted=true;
13
+
}
14
+
elseif(temp==2){
15
+
isPrime=true;
16
+
this.setTimeout(()=>{
17
+
this.postMessage(temp);
18
+
},500);
19
+
firstMessagePostCompleted=true;
20
+
}
21
+
elseif(!firstMessagePostCompleted&&!isPrime){
22
+
letctr=0;
23
+
temp+=1;
24
+
for(leti=2;i<=Math.sqrt(temp);i++){
25
+
if(temp%i==0){
26
+
ctr++;
27
+
break;
28
+
}
29
+
}
30
+
if(ctr>0){
31
+
this.setTimeout(()=>{
32
+
//this.postMessage("<b>" + temp + "</b>");
33
+
this.postMessage(temp);
34
+
},500);
35
+
firstMessagePostCompleted=true;
36
+
}
37
+
else{
38
+
isPrime=true;
39
+
}
40
+
}
41
+
elseif(firstMessagePostCompleted&&!isPrime){
42
+
letctr=0;
43
+
for(leti=2;i<=Math.sqrt(temp);i++){
44
+
if(temp%i==0){
45
+
ctr++;
46
+
break;
47
+
}
48
+
}
49
+
if(ctr>0){
50
+
this.setTimeout(()=>{
51
+
//this.postMessage("<b>" + temp + "</b>");
52
+
this.postMessage(temp);
53
+
},500);
54
+
}
55
+
else{
56
+
isPrime=true;
57
+
}
58
+
}
59
+
elseif(firstMessagePostCompleted&&isPrime){
60
+
this.setTimeout(()=>{
61
+
//this.postMessage("<b>" + temp + "</b>");
62
+
this.postMessage("The next prime number after your input is : "+"<b>"+temp+"</b></br>End of program.</br>------------------------------------------------------------------------------------------------------------------------------");
0 commit comments