Problem I have this code: def has_divisors(n, i=2): “”” Check if a number is prime or not :param n: Number […]

# Tag: primes

## Prime reversion algorithm – JavaScript

Problem I solved the following problem: Consider the range 0 to 10. The primes in this range are: 2, 3, […]

## Finding the prime factors of a number

Problem I am trying to write a program which, given a number as an input, prints the prime factors AND […]

## Project Euler #3 in Haskell

Problem Project Euler #3 asks: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest […]

## Number of prime numbers in a given range

Problem I’ve written a method that should return the numbers of prime numbers in a given range: public static int […]

## Sieve of Eratosthenes using Java 8 streams

Problem I am learning streams and lambdas in Java 8. I wanted to implement the classic Sieve of Eratosthenes using […]

## Tonelli-Shanks algorithm implementation of prime modular square root

Problem I did an implementation of the Tonelli-Shanks algorithm as defined on Wikipedia. I put it here for review and […]

## Finding the Nth prime

Problem I’m going through some of the problems over on exercism and we were asked to write a program that […]

## The Miller-Rabin Primality Test in Clojure

Problem I am new to clojure and I wanted to test out my skills by taking an existing implementation written […]

## First n primes optimization

Problem Pretty standard. Generates the first n primes, input via a scanner. package main; import java.util.Scanner; public class Prime_Generator { […]