# Questions tagged [number-theory]

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

470 questions
Filter by
Sorted by
Tagged with
258 views

### Minimal Triangles

Make an upside down triangle of positive integers. Every number in the triangle must be distinct. Each number is the summation of its two parents (similar to how Pascal's triangle is constructed, but ...
• 43.4k
960 views

### Digit Product Sequences

Here's an interesting sequence discovered by Paul Loomis, a mathematician at Bloomsburg University. From his page on this sequence: Define ...
• 43.4k
2k views

### Simple Factorial Challenge [duplicate]

In light of today's date... A factorial of a number n, is the product of all the numbers from 1 to n inclusive. The Challenge Given an integer n where 0 <= n <= 420, find the sum of the digits ...
• 723
2k views

### Conway's Prime Game

Specifically, Conway's PRIMEGAME. This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers: ...
• 43.4k
1k views

### Seidel Triangle

The Seidel Triangle is a mathematical construction similar to Pascal's Triangle, and is known for it's connection to the Bernoulli numbers. The first few rows are: ...
• 1,050
406 views

### Four Spiraling Axes

Take the numbers 0, 1, 2, 3, 4, ... and arrange them in a clockwise spiral, starting downward, writing each digit in its own separate square. Then, given one of ...
• 43.4k
2k views

### Rotational Average

Given an input integer n >= 10, output the average of all deduplicated rotations of the integer. For example, for input 123, ...
• 43.4k
2k views

### 1, 2, 3, 14... or is it 15?

A well known song by the Irish rock band U2 starts with the singer Bono saying "1, 2, 3, 14" in Spanish ("uno, dos, tres, catorce"). There are various theories as to the significance of those numbers....
• 105k
278 views

### unRSA: solve the private key

Given positive integer n and e, knowing that e<n and that ...
• 24.5k
485 views

### Swap program halves to test divisors

Four integer sequences In this challenge, you will test four different properties of a positive integer, given by the following sequences. A positive integer N is perfect (OEIS A000396), if the sum ...
• 42.7k
1k views

### Some Lonely Primes

I know, I know, yet another primes challenge... Related A lonely (or isolated) prime is a prime number p such that p-2, ...
• 43.4k
2k views

### Is this a truncated triangular number?

Related OEIS sequence: A008867 Truncated triangular number A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of <...
• 13.8k
970 views

### Crazy but Rational Bases

We have many challenges based on base 10, base 2, base 36, or even base -10, but what about all the other rational bases? Task Given an integer in base 10 and a rational base, return the integer in ...
• 13.8k
709 views

### Sparse Protractor

Given some positive integer n, design a protractor with the fewest number of marks that lets you measure all angles that are an integral multiple of ...
• 43.8k
1k views

### Find the dot product of Rationals

I was at a friend's house for dinner and they suggested the idea of a "Prime-factor vector space". In this space the positive integers are expressed as a vector such that the nth element in the ...
• 98.8k
434 views

### Continued Fraction of Digit-wise Sum of Square Roots

Introduction Your task is to generate the first 1000 terms in the continued fraction representation of digit-wise sum of square root of 2 and square root of 3. In other words, produce exactly the ...
• 3,647
1k views

### Regex for multiples of 9

It is easy to describe a finite state machine that recognizes multiples of 9: keep track of the digit sum (mod 9) and add whatever digit is accepted next. Such a FSM has only 9 states, very simple! By ...
• 249
154 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-...
• 111
3k views

### Bertrand's Primes

Bertrand's Postulate states that for every integer n ≥ 1 there is at least one prime p such that n < p ≤ 2n. In order to verify this theorem for n < 4000 ...
• 43.8k
1k views

### Verify Cyclic Difference Sets

A cyclic difference set is a set of positive integers with a unique property: Let n be the largest integer in the set. Let r be ...
• 29.1k
3k views

### Pascal's Triangle (Sort of)

Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first ...
• 43.4k
1k views

### The modulo parity party

You are given an array A of n strictly positive integers, with n ≥ 2. Your task is to map each entry Ai to: 1 if Aj mod Ai is odd for each j such that 1 ≤ j ≤ n and j ≠ i 2 if Aj mod Ai is even for ...
• 193k
2k views

### Make Zero From First 'n' Numbers

Challenge The challenge is to write a code that takes a positive integer 'n' as an input and displays all the possible ways in which the numbers from 1 - n can be written, with either positive or ...
• 5,290
1k views

### Can square tree rings be generated from primes?

Apparently yes! In three easy steps. Step 1 Let f(n) denote the prime-counting function (number of primes less than or equal to n). Define the integer sequence s(n) as follows. For each positive ...
• 105k
2k views

### Diluted Integer Sums

A positive integer can be diluted by inserting a 0 between two bits in its binary expansion. This means that an n-bit number has ...
• 43.4k
2k views

### Write numbers as a difference of Nth powers

Challenge There are many numbers which can be expressed as the difference of two squares, or as the difference of two cubes, or maybe even higher powers. Talking about squares, there are various ways ...
• 5,290
1k views

### Minimise the count of prime factors through insertion

Given two positive integers A and B, return the position p that minimises the number of prime factors (counting multiplicities) of the resulting integer, when B is inserted in A at p. For example, ...
• 42.4k
1k views

### Prime numbers between n and 2n [duplicate]

Bertrand's postulate states that there is always at least 1 prime number between n and 2n for all n greater than 1. Challenge Your task is to take a positive integer n greater than 1 and find all of ...
• 159
3k views

### Recursive Collatz Conjecture

The Collatz conjecture postulates that if you take any positive integer, then repeat the following algorithm enough times: ...
• 773
3k views

### Find the largest number of distinct integers that sum to n

The Task Given an input positive integer n (from 1 to your language's limit, inclusively), return or output the maximum number of distinct positive integers that ...
• 11.2k
870 views

### Write it into number theory style

Write a mathematical statement, using the symbols: There exists at least one non-negative integer (written as E, existential ...
• 24.5k
2k views

• 2,446
1k views

### Do we share the prime cluster?

The prime cluster of an integer N higher than 2 is defined as the pair formed by the highest prime strictly lower than N and the lowest prime strictly higher than N. Note that following the definition ...
• 42.4k
615 views

### Counting Fibonacci Orbits

If we define a Fibonacci-like sequence as fk(n) = (fk(n-1) + fk(n-2)) % k, for some integer k (where % is the modulo operator), the sequence will necessarily be cyclic, because there are only k2 ...
• 197k
9k views

### Yo boy, must it sum

Every positive integer can be expressed as the sum of at most three palindromic positive integers in any base b≥5.   Cilleruelo et al., 2017 A positive integer is palindromic in a given base if ...
• 105k
2k views

### Largest Prime Exponents

Given an integer n >= 2, output the largest exponent in its prime factorization. This is OEIS sequence A051903. Example Let ...
2k views

### Sum the means of the two integers

There are quite a few means in mathematics, such as the arithmetic mean, the geometric mean, and many others... Definitions and Task Note that these are the definitions for two positive integers*: ...
• 42.4k
2k views

### How many unique primes?

One way to represent a natural number is by multiplying exponents of prime numbers. For example, 6 can be represented by 2^1*3^1, and 50 can be represented by 2^1*5^2 (where ^ indicates exponention). ...
• 7,235
701 views

### Writing rational numbers as ratio of factorials of primes

Note: this challenge has been posted on the sandbox. Introduction This challenge is inspired by 2009 Putnam B1, a problem in an undergraduate mathematics competition. The problem is as follows: ...
1k views

### Golf the pseudoprimes!

Introduction / Background In a recent discussion in the crypto chat I was challenged to discuss / help with the Fermat primality test and Carmichael numbers. This test is based on the premise that <...
• 3,393