Search Result

Collapse
3 results in 0.0031 seconds.
Keywords
Members
Tags
prime
  •  

  • 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
    ...
    See more | Go to post

  • Amiya Maitreya
    started a topic Please state the error in following program.
    in Java

    Please state the error in following program.

    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
    ...
    See more | Go to post
    Last edited by Stewart Ross; Sep 4 '10, 08:02 PM. Reason: e-mail address removed from post

  • janutovianca
    started a topic how to print first n primes?
    in C

    how to print first n primes?

    hey there!!!

    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...
    See more | Go to post
Working...