All Questions
8
questions
6
votes
4
answers
436
views
Optimal Solution for the Four Divisors Problem on LeetCode
I recently encountered the Four Divisors problem on LeetCode and managed to achieve a 100% beat rate with my solution. I'd like to share it with you all and gather feedback on its effectiveness and ...
8
votes
1
answer
330
views
Find "prime polynomials" for a user's given prime, bounds, and degree
Very amateur programmer and first-time poster here.
The program I wrote asks the user for a prime number, a lower and upper bound, and a degree (all of these are integers). I want to generate a list ...
3
votes
2
answers
89
views
Number Theory Inhibitor Calculator
I've been working on generating primes and prime products quickly to aid me in my research on prime numbers, their density, etc. The answer to my Large Number Limit Extravaganza question proved to be ...
16
votes
1
answer
782
views
Large Number Limit Extravaganza
I am writing a program that computes
$$n-n \cdot \left(\prod_{i=1}^n (1-\frac{1}{p_i})\right)$$
which is rewritten in my code as:
$$\left(1-\left(\prod_{i=1}^n(1-\frac{1}{p_i})\right)\right) \cdot ...
4
votes
3
answers
2k
views
Lucas sequence implementation
Could you suggest any improvements in this Lucas sequence's implementation:
...
2
votes
1
answer
577
views
Generating numbers that are a product of consecutive primes
I have implemented a correct but horribly coded solution to Project Euler Problem 293.
An even positive integer N will be called admissible, if it is a power
of 2 or its distinct prime factors ...
3
votes
2
answers
204
views
Evaluating f(N,R) mod(m)
The goal is to find \$f(n,r)\mod(m)\$ for the given values of \$n\$, \$r\$, \$m\$, where \$m\$ is a prime number.
$$f(n,r) = \dfrac{F(n)}{F(n-r) \cdot F(r)}$$
where
$$F(n) = 1^1 \cdot 2^2 \cdot 3^...
14
votes
3
answers
8k
views
Tonelli-Shanks algorithm implementation of prime modular square root
I did an implementation of the Tonelli-Shanks algorithm as defined on Wikipedia. I put it here for review and sharing purpose.
Legendre Symbol implementation:
...