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 RSA encryption. Part of what makes an RSA cipher successful is the production of large, random numbers, that are prime. For my project, I am using a library that uses random.org to seed a random number generator, and then producing VERY large values that must be stored in BigIntegers (for … +0 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 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 steps of the script. If someone can poiint out some **error** or lack of understanding, he is welcome an I am grateful! HERE IS THE CODE: from math import sqrt def holeofStrainer(): bigList = [False, False] + [True]*100 print("line 4 - bigList : ", bigList) for num in range(2, 101): … +0 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 smaller than 10100*(log 10100 + log(log 10100) - 1), which we can round to 105000. #include #include #define MAX_INTERVAL 105000 using namespace std; int Wanted_Prime = 0; void Show_Prime(int); void Show_Prime(int Wanted_Prime) { cout << "The 10001-th prime is " << Wanted_Prime << endl; } int main() { … +0 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 about 30% slower. So I gained a tiny bit more speed. +2 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 1299709. 1000000th prime number is 15485863. Here is my code:-- [CODE] #include #include long long arr[100000000]={0}; long long arr1[100000000]; int main() { long long i,j,num,inc=2,m=0,root,q,k; start=clock(); num=86028130; root=sqrt(num)+1; for(i=0;i0) { for(j=inc*i;j<=num;j=j+i) arr[j]=-1; inc++; } } for(i=0;i1) arr1[m++]=i; printf("Enter value of q-"); scanf("%lld",&q); while(q--){ printf("enter the nth prime … +0 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 how many prime numbers there are for the two numbers, calculating the average and lastly asking the user again to input numbers. Can anyone help please! Here is the my code [CODE] #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { int x; int y; int i; int c; int primecount; … +0 #include int main() { int pcheck=1,i; int k=1000 for(i=2;i 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!"<= 1){ cout<<"You do not have a prime number!"< main() { int primenumber; int num; int count; int x; num = 3; printf("Prime number interested in finding a value for?\n"); scanf("%d",&primenumber); if ( primenumber >= 1 ) { printf("First %d prime numbers are :\n",primenumber); printf("2\n"); } for ( count = 2 ; count … +0 Need to find larger prime number then has been inputed.how to do that: I *cin* 5 the reult it self should be 7...? +0 **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 and the second from Y to Z." I have managed to create the program and get the threads running. My only problem is that for input values greater than 90000, the program is no longer reliable e.g. for a range of 100000 - 150000, the program might output only 1 … +0 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, but I cannot quite figure out when/why it would do this. primes.txt is a file with the prime numbers between 2-1,000,000 with one number to a line. primes.txt: https://www.dropbox.com/sh/e3u6prd0pqrhet0/4M4yXYyJIF/primes.txt // // main.cpp // Factor // // Created by Samuel Witt on 11/8/12. // Copyright (c) 2012 Samuel Witt. All rights … +0 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 = Prime.nextInt(); boolean isPrime(int n) { if (n%2==0) return false; for(int i=3;i*i<=n;i+=2) { if(n%i==0) return false; } return true; } } } And here's all the errors that appear: PrimeNumber.java:13: error: ';' expected boolean isPrime(int n) { ^ PrimeNumber.java:13: error: ';' expected boolean isPrime(int n) { ^ 2 errors Can … +0 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 = Prime.nextInt(); System.out.println(isPrime(n)); } static boolean isPrime(int n) { if (n%2==0) return false; for(int i=3;i*i<=n;i+=2) { if(n%i==0) return false; } return true; } } And I got just 1 more error to correct here: PrimeNumber.java:1: error: expected import.java.util.Scanner; ^ 1 error Can anyone please shed some light on correcting … +0 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, which is to display prime numbers from the input data. this is what i've done. and i dont know how to check the prime numbers. hope someone can help me. #include #include using namespace std; void main() { int i,j,n=10, max=0, min=99, x, even=0, odd=0, prime=0; // x0=0,x1=0, … +0 /*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 of eyes to look through my code and tell me if there's anything semantically wrong with it. Thanks */ import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int n1=100;int n2=1000;int n3=10000;int n4=100000; long start = System.nanoTime(); int n=0; for(int i=2;i #include #include #include using namespace std; int perim (int set[],struct krus edge[],int n,int m); void sort(struct krus ed[],int m); struct krus{ char v1; char v2; int weight; }; int main() { system("cls"); int n,m; cout<<"Input Num Vertex : "; cin>>n; int set[n]; for (int i=0;i>m; struct krus … +0 Hi everybody, How can i find out if a number is prime or not ? For example : [CODE]#include using namespace std; int main () { int number; bool isprime; cin >> number; /*algorithm .............. .............. .............. */ if (isprime == false) { cout << "Not prime"; } else { cout << "Prime"; } }[/CODE] +0 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. prof showed a way to call the funtion again by it self but dont really get him so thats why need a bit of help.. [CODE]#include #include int main() { long int num; long int prime(long int num); long int primefactor(long int num); printf("Enter the number whose prime factors … +0 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 +0 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 otherwise. x is an array of bytes (unsigned char) and y is an unsigned integer comprised of two bytes (unsigned short)." EG: f(10,1234)=isPrime(00001010...0x9871...1) I am just completely lost as to what to do. I think there should be a better way than actually creating a class that can store massive … +0

The End.