54 Topics

Member Avatar for
Member Avatar for cka91405

Im writing a code that ask for two positive integers entered from the keyboard. The first integer N is odd in range of 3-15 and the second with be an initial value I. N will be the size of the array. Beginning the center of the NxN array with the …

Member Avatar for Adak
0
275
Member Avatar for ilovejava

An emirp (prime spelled backwards) is a prime number that results in a different prime when its digits are reversed.[1] This definition excludes the related palindromic primes. Emirps are also called reversible primes. this are the list of emirps [url]http://oeis.org/A006567/list[/url] [CODE] public class EmirpProgram { public static void main(String args[]){ …

Member Avatar for NormR1
0
395
Member Avatar for ben1996123

Hello, I just downloaded the [url=https://mattmccutchen.net/bigint/]big integer library[/url], and I want to use it in my prime number checking program. I downloaded the zip file and got a bunch of .cc and .hh files. I need to know what to do with the files, where I should put them, and …

Member Avatar for ben1996123
0
232
Member Avatar for Thisisnotanid

Hi all, I wrote code to list primes that are in a given "radius" of an even number. For example, 6 - 1 = 5 and 6 + 1 = 7, 14 - 3 = 11 and 14 + 3 = 17, etc. I used Euler's sieve to obtain the …

0
99
Member Avatar for salty11

In this program i am trying to find numbers that are multiples of 7,11, or 13, also if the total of the numbers is even or odd also the square root value of each number also if there are any prime numbers in the list [CODE]#include<iostream> #include<iomanip> #include<fstream> #include<cmath> #include<conio.h> …

Member Avatar for frogboy77
0
289
Member Avatar for Ronnie147

Hello I'm trying to create a program that reads a number(which is the amount of pairs) then you input the pairs and then for each pair it prints the prime numbers between the 2 numbers of the pair.Here's the code: [CODE=c++] #include <iostream> using namespace std; class Prime { int …

Member Avatar for Zjarek
0
200
Member Avatar for Progr4mmer

I'm trying to make a program where you enter the number you want to find primes up to which then lists all the primes up to that number... But I enter 100 then it just sits there... Here's my code so far: [CODE]#include <iostream> #include <cmath> int prime(int); int main() …

Member Avatar for Progr4mmer
0
178
Member Avatar for Kanoisa

Hi all, I have begun workin on getting c++ to do physics and things for me so im working on some maths functions. starting small and working up, Just did this one on prime number generation and was wondering if anyone can point out any ways it could be ,made …

Member Avatar for Kanoisa
0
283
Member Avatar for Progr4mmer

im trying to make so one if has two outcomes ex: if(prime % chk == 0) prime++ (and) chk++; i want to know how to put (and) into code so it does both if prime % chk == 0 this is what i have for my prime finder [CODE]class Number …

Member Avatar for Akill10
0
138
Member Avatar for Thisisnotanid

Hi everyone! I've built prime testers and prime listers before, but they only work sufficiently fast for values <= 1e6. I was thinking about all the prime tester projects they have going on, how do they test very large numbers for primality? I'm talking numbers on the order 1e12, 1e13, …

Member Avatar for Thisisnotanid
0
568
Member Avatar for Thisisnotanid

Hi everyone. I was trying to solve Pb 35 on Project Euler ([url]http://projecteuler.net/index.php?section=problems&id=35[/url]). It essentially asks to write a program to list all circular primes under 1e6. I wrote the program and it works well for the most part. However, in the end it seems not to be able to …

Member Avatar for Thisisnotanid
0
2K
Member Avatar for mrcpp

Hi, I tried doing Project Euler #27 today, which asks the following: [QUOTE] Euler published the remarkable quadratic formula: n² + n + 41 It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 40^(2) + …

Member Avatar for mrcpp
0
301
Member Avatar for amit.hak50

I want to find it out for the number 2345678901233.. but it is giving the error ..is there any method to find out the primes beyond the range of integer..[code]import java.util.*; public class inc { int flag=0; int h=2; public void checkprime(int k) { while(h<k){ if(k%h==0){ flag=1; } h++; } …

Member Avatar for apines
0
199
Member Avatar for miha2

Hello guys, I know it's been asked a lot about it here, but that's what I should do (though I'm not quite sure what the teacher wants, is n should be 100, 1000 and further, or use prime numbers. The "first draft" is due this Sunday, the "final draft" is …

Member Avatar for miha2
0
2K
Member Avatar for flyingcurry

I have a prime number method here which checks if the user input is a prime number, I've done some stuff to try to make it more efficient, but I am wondering if there is anything else that can be done, maybe even make the complexity class constant? Thanks. Below …

0
108
Member Avatar for Jimingle10

Intro - I am an electrical major. Having said that, my school has a pilot program this year that I was randomly selected for, that includes introduction to C# in the program. I am not very familiar with programming at all but I must admit, I have made decent progress …

Member Avatar for newenglandguy
0
849
Member Avatar for nwhitesel

Hi everyone! I am working my way through some problems from projecteuler.net and came across one that has stalled me. The task is to find the sum of all primes under 2,000,000. I am attempting to use the Sieve of Eratosthenes algorithm for identifying prime numbers. Here is my code …

Member Avatar for nwhitesel
0
216
Member Avatar for easyb

Hi techies, I am new into C++. I like to write a program that generates all the primes number between 1 and 100. Below is the code I have written but brings no output. Thanks for any help... [CODE]//A program that generates all of the prime numbers between 1 and …

Member Avatar for easyb
0
195
Member Avatar for dragontruong

I am unable to print out the error message when there is no input. I've tried different methods for it, but I can't get it to work. What am I missing? print should be: p2 invalid input but I get: p2 segmentation fault when I do this with an int …

Member Avatar for dragontruong
0
107
Member Avatar for trips.dude

Hi All, I am new to the programming world. I was just writing this code to generate N prime numbers. User should input the value for N which is the total number of prime numbers to print out. I have written this code but it doesnt throw the desired output. …

Member Avatar for samvinogar
0
17K
Member Avatar for Mafia619

Hey, I've got an assignment from my computer teacher in school. I've got to make a program that displays the prime numbers in a range and also display the number of prime numbers that are present. And i'm only supposed to use the basic header files.....that means the program should …

Member Avatar for VernonDozier
0
288
Member Avatar for XStrong

Here is the code I'm working on. The user should be able to type in a number and then after clicking the button, list (in a listbox) of all the prime numbers leading up to the number (including the number if it's prime) MY ERROR/PROBLEM: When i input a number …

Member Avatar for XStrong
0
253
Member Avatar for ChaseRLewis

Newbie Here Edit: This is not homework, I am a chemical engineering student and a math minor. I'm doing programming on the side to help me automate certain calculations later in my career. Also always had a healthy interest in programming. I just read the not doing homework for people …

Member Avatar for vegaseat
0
208
Member Avatar for ddanbe

Blink and you will see them appear in a Console window. This is a translation to C# of a Modula-2 implementation by N.Wirth, the inventor of Pascal. The tested integers are obtained by incrementing alternatively by 2 and 4, thereby avoiding multiples of 2 and 3 in the first place. …

Member Avatar for ddanbe
0
94

The End.