54 Topics

Member Avatar for
Member Avatar for JOSheaIV

Hello everyone, I am posting this more generically in the software development section to see what might be available and to increase a possible success rate. But enough of that let's get to the question at hand. Recently, in C#, I started back up a project of mine to do …

Member Avatar for rubberman
0
427
Member Avatar for vegaseat

Another translation of one of my Python snippets. This function will return a slice of consecutive prime numbers from 2 to a given value limit. In Go the 'int' type (int32) will go as high as 2147483647, but you can replace 'int' with 'uint64' and go as high as 18446744073709551615.

1
1K
Member Avatar for kouty

Hi my friends! Here is a wrong code, Wrong and I don't know why. My purpose is to make a **sieve of Erasthotene**. I make an unique function with many inner loops. But the execution **don't go cross the lines** I illustrate this with the help of printing the different …

0
201
Member Avatar for Petcheco

Hello, guys. This challenge asks us to find the 10001-th prime. Here's my code: // A reasonable approximation is to say that the n-th prime is such that p(n) = n*(log n + log*(log n) - 1). // With that in mind, we can say that the 10001-th prime is …

Member Avatar for Petcheco
0
252
Member Avatar for vegaseat

Just a small mildly optimized function to check if an integer is a prime number. For very large numbers use the Miller-Rabin primality test. There have been questions why I used `not n & 1` to check for even integer n. The more tradional` n % 2 == 0` is …

Member Avatar for vegaseat
2
3K
Member Avatar for cse.avinash

Hello every one Can I have a better algorithm to find the nth prime number, where 1<= n <=5000000. for e.g., 1st prime number is 2. 10th prime number is 29. 100th prime number is 541. 1000th prime number is 7919. 10000th prime number is 104729. 100000th prime number is …

Member Avatar for vantrendin
1
6K
Member Avatar for cufisa

I have been trying to fix this since two eeks and I have no clue what I am doing wrong. I have gotten the program to work so that it can tell if a number is prime or not, but the problem I am having is showing at the end …

Member Avatar for rajii93
0
411
Member Avatar for Josue198s

#include<stdio.h> int main() { int pcheck=1,i; int k=1000 for(i=2;i<k;i++) { if((k%i)== 0) { pcheck=0; break; } } if(pcheck) { printf("%d is a prime .\n",k); } else { printf("%d is not a prime.\n",k); } return 0; } this code works to check any number i that write in k but when …

Member Avatar for rajii93
0
221
Member Avatar for ajanah.ibrahim

IS IT POSSIBLE TO PASS AN ARRAY INTO A FUNCTION AND THEN CALCULATE THE PRIME NUMBERS OUT OF THE LIST?

Member Avatar for David W
1
204
Member Avatar for happygeek

So this morning I get an email from Amazon which promises to inform me of some important information about my Amazon Prime membership. This is the subscription service which, in return for an annual charge of £49 here in the UK, provides free next day delivery on any item which …

Member Avatar for Richard_14
0
382
Member Avatar for birinci2012

def isPrime(num,div=2): if(num==div): return True elif(num % div == 0): return False else: return isPrime(num,div+1)

Member Avatar for slate
0
995
Member Avatar for bnn678

So my code to test a prime number is as follows: PrimeTest(): test = input ( "What number would you like to test? " ) test = int(test) true = 0 divisor = 0 for divisor in range (2, 10): if ( (isinstance( test/divisor, int )== True) & (test/divisor == …

Member Avatar for bnn678
0
372
Member Avatar for Shinedevil

[code]#include <iostream> using namespace std; long int math; long int check; long int divider = 1; long int inputnum; void dividerp(); void counter(); void inputp(); void dividerp(){ math = inputnum/divider; if (math == 1 or inputnum == 2 or inputnum == 1){ cout<<"You do have a prime number there!"<<endl; system("PAUSE"); …

Member Avatar for Mahfuz_1
0
398
Member Avatar for logicslab

Dear Friends, I am looking a small thing , I need a simple code to check the input whether it's prime , if not can enter same repeateddly upto get a proper value . Please provide a simple code snippet and help me Thanks, Anes

Member Avatar for logicslab
-1
369
Member Avatar for parth2911

optput its not proper i am tring to print 1 to n given number prime number plese solved error.....

Member Avatar for nitin1
0
301
Member Avatar for JoeyJes

My questions are how to find the nth prime number? I have figured out how to find a list prime numbers. I'm just stuck as for being able to change my code to only print out the, say, 15th, or 500th prime not every previous prime as well. Any help/feed …

Member Avatar for VernonDozier
0
11K
Member Avatar for marius2010

Need to find larger prime number then has been inputed.how to do that: I *cin* 5 the reult it self should be 7...?

Member Avatar for Lucaci Andrew
0
189
Member Avatar for winter7621

**Please help me out** I am trying to do the following: "Create a program that calculates prime numbers from a certain number X to a number Y. Modify the program so as to run two threads at the same time. The first thread will start counting from X to Y …

Member Avatar for ktsangop
0
2K
Member Avatar for Sam_07

I wrote a short program to factor numbers, and it works in most cases. The problem I am getting is that when I use a very large number I get "Floating point exception: 8." I am assuming that I am trying to divide by 0 on line 43 or 46, …

Member Avatar for NathanOliver
0
4K
Member Avatar for UNDER-18 FG

I'm trying to write a coding that will be able to determine if a number keyed-in is a Prime Number or not. Here's what I did: public class PrimeNumber { public static void main(String args[]) { int n; Scanner Prime = new Scanner(System.in); System.out.println(" Please enter a number: "); n …

Member Avatar for jalpesh_007
0
680
Member Avatar for UNDER-18 FG

Hi, I had to make a java coding that will determine if a number is a prime number or not. Here's the coding I did: import.java.util.Scanner; public class PrimeNumber { public static void main(String args[]) { int n; Scanner Prime = new Scanner(System.in); System.out.println(" Please enter a number: "); n …

Member Avatar for Lucaci Andrew
0
306
Member Avatar for sofy

my task is to type 20 integer numbers from 0 to 99 as the input data. few tasks are to check the maximum and minimum, and find the total number of even and odd numbers. (this one i already got the answer). But i have problem for my next task, …

Member Avatar for sofy
0
356
Member Avatar for Pyler

/*Ok I have code that's behaving unexpectedly The following program is supposed to print prime numbers for n1=100,n2=1000,n3=10000 and n4=100000 except that for n1=100, it prints the squares of primes less than 10. I can implement this same program in c++ and wouldn't get such output. I need another pair …

Member Avatar for VernonDozier
0
230
Member Avatar for Lucaci Andrew

Ok, so, this code snippet is a reply to this thread: http://www.daniweb.com/software-development/cpp/threads/425821/prime-number-c From what I understood form the OPs request, is that, he wanted an algorihm which would check for prime numbers in a given range, applying these conditions: a number is to be considered valid if: a. the number …

Member Avatar for RainbowMatrix
0
586
Member Avatar for panpwintlay

Hello friends As I am a beginner of C# in .NET , I got stuck in this program This program is about displaying prime numbers between the range of o and the number you entered. Its running properly.But the output is not correct. Here is my coding [CODE]using System; using …

Member Avatar for Momerath
-1
1K
Member Avatar for n4j

Hello ,i have problem with code bellow. every data i enter it show me the weight '0'! Can you tell me how can i solve this problem? you should enter number of nods and edges and weight of each edge. [CODE] #include <stdio.h> #include <conio.h> #include <iostream> #include <Windows.h> using …

Member Avatar for n4j
0
253
Member Avatar for Karlwakim

Hi everybody, How can i find out if a number is prime or not ? For example : [CODE]#include <iostream> using namespace std; int main () { int number; bool isprime; cin >> number; /*algorithm .............. .............. .............. */ if (isprime == false) { cout << "Not prime"; } else …

Member Avatar for jaskij
0
248
Member Avatar for dippatel

hi im told to make a program where the user enters a large number like 13195 and the prgrams gives it the highest prime factor, which i 29. now i have to do this using recursion in basic c, without using loops of any kind, so noo for, while etc. …

Member Avatar for VernonDozier
0
7K
Member Avatar for mikeshadow

I need an algorithm that finds how many prime numbers are in a set interval; the interval maximum range is 1 000 000 so a brute force method of checking every number is kinda inefficient

Member Avatar for mikeshadow
0
499
Member Avatar for Labdabeta

I have a difficult function to write and I have no idea where to begin. Here is the definition of what I need to write: "A function f(x,y) which returns true if the binary number formed by concatenating the bits of x, 8*y-1 zeroes and a one is prime, false …

0
109

The End.