# Questions tagged [number-theory]

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

378 questions
Filter by
Sorted by
Tagged with
3k views

### Is it a lobster number?

Introduction A "lobster number", by my own designation, is a number that contains within itself all of its prime factors. The "lobster" description was inspired by the recent ...
1k views

### Build a Primitive Root Diffuser

Introduction When a room has bare, parallel walls, it can create unpleasant repeating acoustic reflections (echoes). A diffuser is a device mounted on a wall which creates a blocky surface of many ...
806 views

### Compute modular inverse

Given two positive numbers $x$ and $n$ with $x<2^n$, write the shortest possible function to compute $x^{-1} \mod 2^n$. In other words, find $y$ such that $xy=1 \mod 2^n$. Your ...
2k views

### Finding The nth Prime such that the prime - 1 is divisible by n

Problem The goal is as the title says to find the $n$th prime such that $\text{the prime}-1$ is divisible by $n$. Explanation Here is an example so you understand the question, this is not ...
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 <...
2k views

### Divisor skyline

For any positive integer $k$, let $d(k)$ denote the number of divisors of $k$. For example, $d(6)$ is $4$, because $6$ has $4$ divisors (namely $1, 2, 3, 6$). Given a positive integer \...
5k views

### Am I divisible by double the sum of my digits?

Given a positive integer as input, your task is to output a truthy value if the number is divisible by the double of the sum of its digits, and a falsy value otherwise (OEIS A134516). In other words: <...
4k views

On 4chan, a popular game is get. Every post on the site gets a sequential post ID. Since you can't influence or determine them, people try to guess (at least a part of) their own post number, usually ...
2k views

### Find a divisibility pattern

Background Sometimes when I'm golfing a program, I'm presented with the following situation: I have an integer value $x$ on some fixed interval $[a, b]$, and I'd like to test whether it's in some ...
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 ...
2k views