Questions tagged [primes]

For challenges about identifying and manipulating prime numbers

Filter by
Sorted by
Tagged with
3
votes
10answers
391 views

Composite Factor Soup

Per the fundamental theorem of arithmetic, for a given number \$n\$, it is possible to find it's prime factors, and they are unique. Let's imagine we talk only of \$n\$ that is non-prime (composite). ...
3
votes
10answers
1k views

Is it really a comcoin?

Very interesting background Comcoins are a currency like any other. The residents of Multibaseania (an economically robust system of city-states with very few residents in a galaxy far, far away) use ...
3
votes
12answers
386 views

Please Read Primes

Do you know the book Murderous Maths, in the Horrible Science series? In the book, the Laplace Princess' "ridiculous" cipher might be interesting enough and simple enough to be a code-golf challenge. ...
3
votes
2answers
381 views

Preprocessing primality

The challenge: Given an integer N, 1 < N < 2³¹, write code that uses the C preprocessor to determine whether N is prime, and produces a "Hello world" program if N is prime, or an error ...
3
votes
0answers
86 views

Find the Nth number whose only prime factors are 2, 3, 5, and/or 7 (humble numbers) [duplicate]

First post here! I recently participated in a small friendly competition and this was one of the questions: A positive integer whose only prime factors are 2, 3, 5 or 7 is called a humble number. ...
2
votes
4answers
231 views

OMG! We're Twinning! [duplicate]

Introduction We define twin primes as two natural numbers p,p+2 which both are prime. Example: 5 and ...
1
vote
0answers
121 views

Output the happy primes [duplicate]

Input: n Output: A list of length n, with each element being the nth happy prime. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the ...
0
votes
3answers
124 views

Prime Factorial [duplicate]

For the purposes of this question, the prime factorial of a number n is the result of multiplying all prime numbers smaller than n, and then multiplying the result by n. Your Task: Write a program ...
0
votes
0answers
75 views

Fastest way to generate Smarandache–Wellin number [duplicate]

Given a number n find the Smarandache–Wellin number for n. Ex: for n=2 output=23 for n=5 output=235711 Answer it in ruby or python. given constraints are n<=70000
-1
votes
6answers
329 views

Primes, as efficiently inefficient as possible [duplicate]

Write a program that tests if a number n is prime by checking that none of the integers between 2 and ...
-1
votes
1answer
217 views

Ponderous primality testing [closed]

One of my favorite algorithms was posted on Stack Overflow as an answer to What is the fastest way to generate prime number recursively?. In pseudocode: Nathan's algorithm ...
-1
votes
2answers
318 views

Find prime which is generating longest primes sequence using p(n+1)=(p(n)^2+1)/2

Consider following recurrence relation: p[n + 1] = (p[n]^2 + 1) / 2 If p[1], p[2], ..., <...
-2
votes
3answers
317 views

Return prime factorization of a number [duplicate]

Yes, this is old and probably very simple, but I really want to be mindblown by things that I thought were obvious, so here's the challenge: You're given a positive integer as the input and you need ...
-3
votes
1answer
133 views

number decomposition [duplicate]

It's been a while since I posted here, so here we go another day another challenge. Challenge : Given a number(n) split it into it's prime factors. Input : A ...
-3
votes
3answers
165 views

Multi-Base Primes [closed]

For the purpose of this challenge, a multi-base prime is a prime which, when written in base 10, is prime in one or more bases smaller than 10 and larger than 1 as well. All single-digit primes are ...
-4
votes
1answer
138 views

Find prime factors of sum of non-composite Fibonacci numbers up to n

The Challenge Given a number, find the sum of the non-composite numbers in the Fibonacci sequence up to that number, and find the prime factors of the sum. For example, if you were given 8, the non-...
-5
votes
3answers
111 views

Geiger counter prime generation [closed]

This challenge is quite simple to conceptualise, but likely a lot harder to execute. In this challenge, the program will have to detect the number N of its characters that have been randomly changed (...
-7
votes
7answers
344 views

Puzzle: Factor these 256-bit semiprimes [closed]

Challenge Write a program to factor this set of 10 numbers: ...