Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
2 answers
68 views

I am attempting to write a code to calculate the 1000th prime number and I'm running into an issue with my loop counter that i don't understand. prime_test = 1 count=0 for count in range(0,1001): ...
irtotallynotrobot's user avatar
1 vote
1 answer
142 views

I've done this exercise, it was about finding if a number is "ugly" or not. A number is ugly if it has only 2, 3, or 5 as factors. otherwise, it's not ugly. this is my solution: include <...
Gabriel Burzacchini's user avatar
1 vote
1 answer
68 views

As an example, suppose I search for prime numbers in the arithmetic progression $30n+11$ ( with $$ simulated LaTeX math mode), To print these prime numbers in Sage, I use the following sage : [30*n+11 ...
user19872448's user avatar
1 vote
1 answer
171 views

So this is my first time writing a post here. I'm very new to the assembly language and started the learning journey with emu8086. Recently I wrote a program that detects if the number entered is ...
Eddy0296's user avatar
-1 votes
1 answer
56 views

I am unable to get all the prime numbers printed .can someone help me with this .I get all the values except 2 and 3 . It starts with 5 . public static void primesinRange(int n) { int flag=1; int ...
decoder's user avatar
  • 19
0 votes
2 answers
111 views

I am a mathematician who is interested in the product of non-gaussian primes. A prime p is called non-gaussian, if p mod 4 = 1. It is easy to generate an ongoing list of natural numbers in Python: ...
Wilfred Montoya's user avatar
-6 votes
1 answer
76 views

I know the mistake here is in the for loop as it should be i=2 but if i put it as i=1 then why is it not entering in the loop .could someone dry run this code and tell me how exactly is this an issue ...
decoder's user avatar
  • 19
0 votes
2 answers
9k views

Hi I know there are lots of solutions to this problem but I wanted some help finding out why my answer is wrong. Here's my answer: number = int(input("enter a number: ")) for n in range(2, ...
Lola_Cola's user avatar
0 votes
2 answers
76 views

This was a task given on a coding competition a few months ago, and its still bugging me now. I did solve it, but my code did not give the result in required time for 3 test samples, likely due to the ...
user avatar
1 vote
1 answer
120 views

The problem says that the user will input numbers till he inserts 0 (exit) then if there are any prime digits in that given number, the program shall multiply them. For example: input : 4657 output : ...
SkkyDMG's user avatar
  • 29
2 votes
2 answers
186 views

Anyone familiar with Haskell will have likely seen this implementation of the Fibonacci sequence. fibs = 0:1:zipWith (+) fibs (tail fibs) The way I understand this is as follows: Haskell's lazy ...
Christian Legge's user avatar
1 vote
1 answer
309 views

So I started learning C language for Uni and got stuck with this exercise, I found a way to ge the prime numbers of a number but I don't know how to multiply the prime numbers and display them. int ...
SkkyDMG's user avatar
  • 29
1 vote
1 answer
135 views

Out of prime numbers less than 201920190 how to find those that dont have digit '7' in their str representation? I need to count the number(count) of such prime numbers that have no '7' in them. Std ...
ERJAN's user avatar
  • 24.6k
0 votes
1 answer
146 views

This is a very simple question about python. I was trying to get a list of prime numbers so I tried primes = [2] for i in primes: for j in range(50): if j%i != 0: primes.append(j) ...
Fly by Night's user avatar
0 votes
1 answer
57 views

def prime(n): if n==2 or n==3: return True if n==1: return False f=True for i in range(2,int(n**0.5)+1): if n%i==0: f=False break ...
Sai Pramod's user avatar
1 vote
0 answers
209 views

I've been trying to make an efficient prime generator that successfully utilises wheel factorisation to be faster than a basic sieve of Eratosthenes implementation but my code ends up being a lot ...
creeper_the_cat's user avatar
0 votes
1 answer
104 views

I am new to Prolog programming so still learning. I'm tryingto create a program that accepts a value X and returns a list of all prime numbers between 6 and X. I'll also be later adding an error ...
Cik02's user avatar
  • 69
1 vote
1 answer
287 views

I have been trying to learn haskell by trying to do some simple problems. The Problem Currently, I am trying to implement a function primeFactorization :: Integer -> [(Integer, Integer)] such that ...
Naitik Mundra's user avatar
0 votes
0 answers
125 views

In cases of low memory available I thought it was possible to implement a double-segment sieve to find prime numbers in a neighborhood of n. In practice, a segmented sieve has dimension dim_seg_1 for ...
user140242's user avatar
-1 votes
1 answer
199 views

There is a syntax error in line 3. I'm unsure of how to correct the error. Write a python function is_prime() which takes one integer as an argument and returns True or False (boolean values). If the ...
Victoria's user avatar
1 vote
2 answers
100 views

I'll try to keep this short. So my task is to find the last prime number in an array, if there's any. But right now my program assigns any number it wants from the array to the lastPrimeNumber ...
righN's user avatar
  • 47
-4 votes
2 answers
1k views

I've got a task in my lesson to write a function that will check if a number is prime, it will return 1 if it is and 0 if it is not and all of that to do recursively. the function will look like that :...
idan shavit's user avatar
2 votes
1 answer
115 views

I am trying to come up with an algorithm that can find all primes from a starting to an ending number, without starting at 2 and using the Sieve of Eratosthenes to calculate all primes to the ending ...
ullispc's user avatar
  • 23
0 votes
1 answer
543 views

I've been working on an implementation of Shamir's Secret Sharing, and was wondering if the prime number selected will impact on the security. This is mainly because I've seen some implementations on ...
RuiSiang's user avatar
  • 194
0 votes
3 answers
740 views

I am having a really hard time finding a way to store massive prime numbers in c#. I tried everything but nothing worked out for me. For example. How can I store this number. ...
vennr's user avatar
  • 57

1
3 4
5
6 7
68