Loops/Increment loop index within loop body: Difference between revisions
Content added Content deleted
ReeceGoding (talk | contribs) m (→{{header|R}}: Shortened link) |
|||
Line 3,842: | Line 3,842: | ||
42 -> 99,504,028,301,131</pre> |
42 -> 99,504,028,301,131</pre> |
||
=={{header|R}}== |
=={{header|R}}== |
||
R cannot complete this task with a for loop. See https://stackoverflow.com/a/5913329/ |
R cannot complete this task with a for loop. See https://stackoverflow.com/a/5913329/ . Instead, we must go down the same path as the Kotlin solution. Because it is sufficient for numbers this small, we will save ourselves some work and use the gmp library's isprime function for checking if a number is prime. |
||
<lang R>i<-42 |
<lang R>i<-42 |
||
primeCount<-0 |
primeCount<-0 |
||
Line 3,899: | Line 3,899: | ||
Prime count: 41; The prime just found was: 49,752,014,150,467 |
Prime count: 41; The prime just found was: 49,752,014,150,467 |
||
Prime count: 42; The prime just found was: 99,504,028,301,131</pre> |
Prime count: 42; The prime just found was: 99,504,028,301,131</pre> |
||
=={{header|Racket}}== |
=={{header|Racket}}== |
||