method name:
public static boolean isSpecial (int n)
given a number check if its special this is how special defined:
Start with the natural numbers; at the k-th sieving step, remove every (k+1)-st term of the sequence remaining after the (k-1)-st sieving step; iterate.
1, 3, 7, 13, 19, 27, 39, 49, 63, 79, 91, 109, 133, 147, 181, 207, 223, 253, 289, 307, 349, 387, 399, 459, 481, 529, 567, 613, 649, 709, 763, 807, 843, 927, 949, 1009, 1093, 1111, 1189, 1261, 1321, 1359, 1471, 1483, 1579, 1693, 1719, 1807, 1899, 1933, 2023
this is needs to be done by recursion this what i did:
public static boolean isSpecial (int n) {
if((n % 5 != 0) && (n % 2 != 0))
return true;
return(isSpecial(n-1));
}
i dont know how to do it by recursion,from what ive read the number is never divisible by 2 or 5,so should i check if every previous number is not divided 2 and 5?