diff --git a/lessons/LuckyNumbers.md b/lessons/LuckyNumbers.md new file mode 100644 index 00000000..6ea20589 --- /dev/null +++ b/lessons/LuckyNumbers.md @@ -0,0 +1,15 @@ +class Solution +{ + // Complete the function + // n: Input n + // Return True if the given number is a lucky number else return False + public static boolean isLucky(int n) + { + // Your code here + for(int i=2; i<=n; i++){ + if(n%i==0) return false; + n = n - n/i; + } + return true; + } +}