Created
November 28, 2018 09:56
-
-
Save raupachz/b0771b04895d66b1692abaaa593bedfc to your computer and use it in GitHub Desktop.
The code for my Medium story "Choosing the right amount of memory for your AWS Lambda Function"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Prime { | |
public int nth(int n) { | |
int p = 2; | |
for (int i = 0; i < n; ) { | |
if (prime(p++)) { | |
i++; | |
} | |
} | |
return --p; | |
} | |
boolean prime(int p) { | |
int n = (p / 2 + 1); | |
for (int i = 2; i < n; i++) { | |
if (p % i == 0) { | |
return false; | |
} | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment