About 2,840,000 results
Open links in new tab
  1. Recursive program for prime number - GeeksforGeeks

    Jan 27, 2022 · In this article, you will see how you can write the logic of stored procedure to generate prime numbers for any given input. Title : Given a number N print all the prime …

  2. Prime Number Using Recursion in Java - PrepInsta

    Here, we will discuss the program for prime number using recursion in Java. We are given with a number and need to check if its prime or not.

  3. Printing prime numbers in Java using recursion - Stack Overflow

    Jul 22, 2014 · Just return whatever the recursive method call returns: return primes(x, i-1); Also, modify the first case's condition to i == 1 so it returns 1 on primes correctly. Works like a …

  4. recursion - Java: Find out if a number is prime recursively - Stack ...

    Aug 9, 2017 · I'm writing a function that returns true if a number is prime, and false otherwise. Here is my current code: public static boolean checkPrime(int n, int currDivisor){ if(n < 2){ …

  5. Prime Number Program in Java - GeeksforGeeks

    Apr 7, 2025 · A prime number is a natural number greater than 1, divisible only by 1 and itself. Examples include 2, 3, 5, 7, and 11. These numbers have no other factors besides themselves …

  6. Check if a number is prime using recursion - Stack Overflow

    Dec 2, 2018 · return isPrimeRecursive(n, i + 2); if (n <= 2 || n % 2 == 0) { return (n == 2); return isPrimeRecursive(n, 3); System.out.println(isPrime(Integer.parseInt(args[0]))); With your code, …

  7. Java Program to Check whether a Number is Prime or Not using Recursion

    This is a Java Program to Find if a Number is Prime or Not using Recursion. A number is said to be a prime number if it is divisible only by itself and unity. Enter an integer as an input. Now we …

  8. Check Prime Number in Java [3 Methods] - Pencil Programmer

    Method 3: Using Recursion We can also check whether a number is prime or not using a recursive function. To the recursive function, we pass the next potential factor as i and check if …

  9. Prime Numbers in Java: Simple Logic and Code - scholarhat.com

    Sep 25, 2024 · 3. Prime Number Program Using Recursion. You can also find the prime numbers in Java using the recursion method. This approach recursively checks for divisibility from 2 up …

  10. Recursive method for prime numbers in JAVA - Stack Overflow

    Dec 6, 2015 · The normal way to handle that using recursion would be to define a recursive "is_divisible" function: # for integers m >= 1 is_prime(m): return is_divisible(m, 1) …

  11. Some results have been removed
Refresh