Skip to main content
Filter by
Sorted by
Tagged with
-2 votes
0 answers
75 views

Imagine you get sequence of integers: [a1 a2 a3 ... an] where: 1 <= a <= 10^6 1 <= n <= 10^6 You are given a function f(x) that can change a number to the closest lower prime number, or ...
ToridFartFart's user avatar
0 votes
3 answers
366 views

What is the most efficient (time complexity not space) algorithm to generate all continuous prime numbers until the algorithm is halted? There are infinite prime numbers, the algorithm will be halted ...
aku jack's user avatar
2 votes
0 answers
145 views

I am working with a situation in which I need to turn an arithmetic string expression (e.g. (3/2) * (3**4 / (20 * 4))**(-1/4)) into the following prime factorization form: $\prod_{p:\text{prime}}p_i^{...
F. X. P.'s user avatar
  • 145
-2 votes
3 answers
274 views

Let there be integer n. Count how many numbers there are from 1 to n that has the sum of divisors being a prime number. Example: Input: 10 Output: 3 Explanation: There are 3 numbers with the sum of ...
Nguyen Tran Tung's user avatar
2 votes
1 answer
205 views

For example, given this sequence of the first 499 primes, can you predict the next prime? 2,3,5,7,...,3541,3547,3557,3559 The 500th prime is 3571. Prime Number Theorem The Prime Number Theorem (PNT)...
vengy's user avatar
  • 2,467
3 votes
0 answers
107 views

I am writing a Python program to find a list of prime numbers. I wrote it using the Sieve of Eratosthenes: def Eratosthenes(n:int) -> list[int]: if n <= 2: return [] l = list(range(3,...
Mr. W's user avatar
  • 275
2 votes
1 answer
139 views

Im currently trying to solve the prime-k factor problem, where I have to find the sum of all primes factorial 1-5 ! and then mod(%) to itself. An example would be the prime 7. (7-1)!+(7-2)!....(7-5)!=....
Egelund48's user avatar
0 votes
0 answers
62 views

I made a RSA encrypting and decrypting program. Everything works well as it is suppose to be. However when I decrypt the message, it doesn't give me the message. Can somebody check which part is wrong ...
user26695021's user avatar
4 votes
9 answers
1k views

I started learning C the previous day and I wrote a program to print within a given range. Minimum and Maximum of range is given by user. #include <stdio.h> int check(int number) { if (...
nkminion's user avatar
-2 votes
2 answers
147 views

I am writing a python program to find and return a list of Twin primes between two numbers. This is my code: #prime selector def is_prime(num): if num < 2 or num % 2 == 0: return False ...
Kshitij Jha's user avatar
3 votes
1 answer
143 views

I wrote a simple Haskell function, that gives a list of primes. primes' :: [Int] -> [Int] primes' (p : xs) = p : primes' (filter (\x -> x `rem` p /= 0) xs) primes :: [Int] primes = primes' [2 .....
Andrey's user avatar
  • 71
1 vote
1 answer
83 views

I'm trying to find out whether a given number is prime or not. For example, when I enter the input as 5, it should output "5 is a prime". However, I get multiple, conflicting outputs. This ...
Anusha_Wilson's user avatar
0 votes
0 answers
46 views

I ask this in the context of hashing where a prime greater than some constant is required for example in universal hashing: h(k) = [(a.k+b) mod p] mod m a and b are random numbers m is the size of ...
dk dk's user avatar
  • 1
1 vote
3 answers
119 views

#task:input a number ,then determine if it is a prime number. 1.question:how can I optimize my code ,and when I run this code ,I find that some prime numbers get the answer "No". #include &...
jay's user avatar
  • 11
1 vote
0 answers
77 views

I'm generating a large range of primes starting from a non-zero value. e.g., Primes from 2^64 to 2^64+1,000,000. Due to not needing all primes from 0 - instead starting at 2^64 - a sieve is both ...
JoshW's user avatar
  • 105
-1 votes
1 answer
131 views

The error that I'm struggling, with some examples I have written a code for finding prime numbers using sieve of Eratosthenes algorithm, but the problem is my code works as it tends to be, but it ...
user avatar
3 votes
1 answer
129 views

I am writing a program in Rust to check if large numbers are Mersenne primes for fun. For some reason, when I test the program with an exponent of 1_000_000_000 it takes around 5 seconds, but when I ...
figgyfarts's user avatar
0 votes
0 answers
50 views

I have an implementation of the Miller-Rabin-Primetest, coded in python3. Unfortunately I have no idea how "fast" this test should be on my machine. With my code I can test the number $n = 2^...
Lereu's user avatar
  • 151
0 votes
2 answers
63 views

I am currently engaged in solving Question 37 ("Truncatable Primes") on Project Euler. In essence, the task involves identifying 11 prime numbers with the unique property that, when any ...
fish_brain's user avatar
0 votes
1 answer
159 views

I was interested in finding out if I could compact a number using prime exponents. During my research into this, I came across several solutions one being the creation of a sequential series of primes ...
Tone's user avatar
  • 21
0 votes
0 answers
125 views

The following algorithm is for modular multiplication modulo a prime number p, xi represents the bit number "i" of the X input, Y is the second input. i know how to implement this algorithm ...
nis bn's user avatar
  • 3
0 votes
1 answer
127 views

I was testing the basic version of the Fermat Factorization method, so I'm not using any improvement whatsoever. The code I wrote in Python works as fast as expected for those numbers obtained by ...
lanzik03's user avatar
3 votes
2 answers
105 views

I am a relatively new programmer in J-Lang and recently discovered its efficacy in Code Golfing, where it excels in scoring. I am currently working on a coding problem that involves printing all prime ...
user21524036's user avatar
0 votes
1 answer
394 views

REPORT Z_PRIMENUMBER. CLASS ZCL_NTH_PRIME DEFINITION FINAL CREATE PUBLIC. PUBLIC SECTION. METHODS prime IMPORTING input TYPE i RETURNING VALUE(result) TYPE i ...
Aniq Murad's user avatar
-2 votes
3 answers
275 views

Consider the following data: arr = [2,3,5,7,11,13,17,19] n = 100 Output of the given should be 0 since n % 2 = 0 and arr[0] = 2. Since array is sorted I want to use that to my advantage and design an ...
Nikola Savić's user avatar

1
2 3 4 5
68