Function to determinate whether a number is prime or not
Hello, I made a function to define whether a number n is prime or not. But I have two problems that will be described, but first let's go to the function:
Code:
def esprimo(n):
m=str(n)
if n<=1:
a=False
elif n==2:
a=True
elif int(m[-1])==(2 or 4 or 6 or 8 or 0 or 5):
a=False
elif n%3==0:
if n!=3:
a=False
else: a=True
elif n%7==0:
if
Hey ! I am a Semi-pro/Amateur kind of Java Programmer. A student. I use BlueJ to write Java Programs. I was writing a Java Program to display the prime factors of a number entered. However the compiler was constantly showing error of missing return statement. Why ? and can u tell me how to cure it ?
Code:
public class Prime_Factorizer
{
public static void main(int a)
{
final int l = a ;
System.out.println("Prime
we were asked to make a code for printing prime numbers from 3 until the [I]n[I]th prime number but i can't seem to find the right solution for this one.
when i print my work it prints some other numbers that has the factor of another prime number
it prints the numbers:
3, 5, 7, 9 ,11, 13, 15...
i'm a beginner here, so please help me.
i really would appreciate...