# Questions tagged [number-theory]

Number theory involves properties and relationships of numbers, primarily positive integers.

470 questions
Filter by
Sorted by
Tagged with
1k views

### Nth K-Ugly Number

Write the shortest code in any language of your choice to find the $N$th $K$-ugly number. A $K$-ugly number is a number whose only prime factors are the prime numbers $\le K$. $K$-ugly ...
• 1,311
2k views

### Evaluate the primorial of a number [duplicate]

The primorial of a number is the product of all the primes until that number, itself included. Take a number from STDIN as the input and evaluate its primorial, ...
• 1,649
2k views

### The making of "Spot It!": Finding almost unique sets

Puzzle: Find a deck of c cards, each containing p pictures, such that no two pictures match on a given card, and exactly 1 picture on each card matches exactly 1 picture on each of the other cards, ...
• 197
2k views

### Find largest prime which is still a prime after digit deletion

Over at https://math.stackexchange.com/questions/33094/deleting-any-digit-yields-a-prime-is-there-a-name-for-this the following question is asked. How many primes are there that remain prime after you ...
896 views

### Bijection between binary strings and pairs thereof

Input: Either one or two strings consisting of '0's and '1's. If there are 2, they are separated by a space. All strings are of ...
• 6,208
560 views

### List ALL prime-factorized natural numbers in ANY order [closed]

This is a variant of List prime-factorized natural numbers up to N in ascending order, but the solutions can be very different. Write a program that outputs prime factorizations of all natural ...
• 4,360
1k views

### List prime-factorized natural numbers up to N in ascending order

For a given n list prime factorization of all natural numbers between 1 and n in ascending ...
• 4,360
4k views

### Calculate hamming weight with low hamming weight

Create a program that computes the hamming weight of a string. Winner is the program with the lowest hamming weight. Rules: Hamming weight for an ASCII character is defined as the total number of ...
• 4,506
2k views

### Undulant numbers [duplicate]

An undulant number is a number where its digits alternate between up and down like the following number: 461902 or 708143, or even 1010101, but not 123, because 2 < 3. Write a program or function ...
• 341
850 views

### Another amicable number problem

Two numbers are said to be 'amicable' or 'friends' if the sum of the proper divisors of the first is equal to the second, and viceversa. For example, the proper divisors of 220 are: 1, 2, 4, 5, 10, ...
• 341
1k views

### Square Number Digit Density

The square number digit density (SNDD) of a number - invented by myself - is the ratio of the count of square numbers found in consecutive digits to the length of the number. For instance, 169 is a 3-...
• 6,083
3k views

### Find the prime factors

In this task, you have to write a program, that computes the prime factors of a number. The input is a natural number 1 < n < 2^32. The output is a list of the prime factors of the number in the ...
• 10.1k
906 views

### Greatest greatest common divisor

Find the greatest gcd of the numbers $n^m + k$ and $(n+1)^m + k$ for given m and k. For example, for ...
• 5,502