CARVIEW |
Select Language
HTTP/2 200
date: Tue, 29 Jul 2025 19:51:43 GMT
content-type: text/html; charset=utf-8
cf-ray: 966f270ee8341ec2-BLR
cf-cache-status: DYNAMIC
cache-control: private
set-cookie: prov=16b58a60-3480-4829-ae9f-4771b223de4f; expires=Wed, 29 Jul 2026 19:51:43 GMT; domain=.stackexchange.com; path=/; secure; httponly
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding
content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com
x-clacks-overhead: GNU Terry Pratchett
x-frame-options: SAMEORIGIN
x-request-guid: 8eb0e0bf-1475-4ccb-8e3e-3a11f3358c77
x-worker-origin-response-time: 488000000
x-dns-prefetch-control: off
set-cookie: prov=16b58a60-3480-4829-ae9f-4771b223de4f; Path=/; HttpOnly; Domain=stackexchange.com
set-cookie: __cf_bm=Xv0_doT62u6tu.edHnzmGuFNgsyFAWzLC73xaa755VA-1753818703-1.0.1.1-xvGb8OrupoZotaUubNhAAVT96aiEsT1t1A78LKbso6UkAUnjMnMGpgMiuQiU3nzJdJpPozU2fyiP5uTM43nbujxMXyUf0F2KIibccHOrNcA; path=/; expires=Tue, 29-Jul-25 20:21:43 GMT; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=pLY.MBYcIMnZTBtySjuPyvXT1JUBE1mYEpo8ybvs2m0-1753818703683-0.0.1.1-604800000; path=/; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
server: cloudflare
content-encoding: gzip
Newest 'number-theory' Questions - Code Golf Stack Exchange
Skip to main content
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more.
View results.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsQuestions tagged [number-theory]
Number theory involves properties and relationships of numbers, primarily positive integers.
476 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
23
votes
6
answers
2k
views
Computing Pi with iF*ck
Objective
Compute \$\pi\$ using nothing but \$i\$ (\$\sqrt{-1}\$).
Guidelines
ONLY exponentiation and multiplication may be used (i.e. \$i^i\$ or \$ii\$)
No additional symbols may be used (so no ...
8
votes
17
answers
4k
views
Is this number Ugly?
Related, but not dupe (Asking about the n-th k-smooth number whereas I'm only asking if a certain number is 5-smooth.)Source: Partially inspired by Leetcode's 5-smooth Number problem, but partially ...
20
votes
28
answers
3k
views
Is the number sum of 3 squares?
Challenge
Write a program (function) that given a nonnegative integer input, output whether the number can be represented as the sum of 3 square numbers. That is, the program should, given nonnegative ...
11
votes
7
answers
2k
views
Perfect ruler search
Definitions:
A sparse ruler, or simply a ruler, is a strict increasing finite sequence of nonnegative integers starting from 0, called marks.
A ruler is complete if the set of all distances it can ...
11
votes
13
answers
1k
views
Number of complete binary unordered tree-factorizations of n
For prime p, the factorization tree is a single vertex in just one way so that a(p) = 1.
For composite n, the two subtrees at n are a split of n into two factors n = d * (n/d), without order, so that
$...
14
votes
5
answers
669
views
Sum-of-four-squares grid
Output a grid of characters visualizing the decomposition of a number into a sum of four perfect squares.
Challenge
Given a nonnegative integer \$0 \le n \le 2^{30}\$, output a \$2^k \times 2^k\$ ...
16
votes
6
answers
1k
views
Golfing the complexity with subtraction
The Mahler-Popken complexity, \$C(N)\$, of a positive integer, \$N\$, is the smallest number of ones (\$1\$) that can be used to form \$N\$ in a mathematical expression using only the integer* \$1\$ ...
14
votes
13
answers
931
views
*Trivial* near-repdigit perfect powers
Task
Output the sequence that precisely consists of the following integers in increasing order:
the 2nd and higher powers of 10 (\$10^i\$ where \$i \ge 2\$),
the squares of powers of 10 times 2 or 3 (...
11
votes
4
answers
2k
views
Output a 1-2-3-5-7... sequence
Follow-up of my previous challenge, inspired by @emanresu A's question, and proven possible by @att (Mathematica solution linked)
For the purposes of this challenge, a 1-2-3-5-7... sequence is an ...
22
votes
15
answers
2k
views
Output a 1-2-3 sequence
For the purposes of this challenge, a 1-2-3 sequence is an infinite sequence of increasing positive integers such that for any positive integer \$n\$, exactly one of \$n, 2n,\$ and \$3n\$ appears in ...
15
votes
16
answers
1k
views
Pretty Palintiples
Imagine you have a positive integer number \$n\$. Let \$m\$ be the number obtained by reversing \$n\$'s digits. If \$m\$ is a whole multiple of \$n\$, then \$n\$ is said to be a reverse divisible ...
18
votes
26
answers
2k
views
Is it a tetrate of two?
The tetration operation consists of repeated exponentiation, and it is written ↑↑. For instance,
3↑↑3 =3 ^(3^3) = 3^27 = 7,625,597,484,987
A tetrate of two is an ...
11
votes
10
answers
2k
views
Egyptian fraction representations of 1 without prime denominators
Background
As noted in this question, for all positive integers \$n>2\$ there exists at least one Egyptian fraction representation (EFR) of \$n\$ distinct positive integers \$a_{1} < a_{2} < \...
4
votes
5
answers
461
views
Generate a sequence of \$n\$ consecutive composite numbers
Definitions
The common methods to generate consecutive composites are
$$\overbrace{(n+1)! + 2, \ (n+1)! + 3, \ \ldots, \ (n+1)! + (n+1)}^{\text{n composites}}$$
$$\overbrace{n!+2,n!+3,...,n!+n}^{\text{...
13
votes
20
answers
1k
views
Modular Equivalence
Given two numbers \$x,y > 2, x≠y \$ output all integers \$m\$ such that
$$
x + y \equiv x \cdot y \pmod m
$$
$$
x \cdot y > m > 2
$$
Input
Two integers
Output
A list of integers
Test cases
<...
Welcome to Code Golf and Coding Challenges Stack Exchange! This is a site for recreational programming competitions, not general programming questions. Challenges must have an objective scoring criterion, and it is highly recommended to first post proposed challenges in the Sandbox.
- The Overflow Blog
-
-
- Featured on Meta
-
-
Related Tags
code-golf × 440
math × 186
sequence × 119
number × 101
primes × 91
arithmetic × 47
decision-problem × 43
integer × 27
combinatorics × 20
base-conversion × 16
fastest-code × 15
integer-partitions × 15
factoring × 14
division × 13
code-challenge × 10
rational-numbers × 9
binary × 8
fibonacci × 8
restricted-time × 8
polynomials × 7
abstract-algebra × 7
permutations × 5
more related tags
Hot Network Questions
- Electrician ran neutral and ground to the same bar, and is telling me it's common practice. Pictures show my main and sub. Is he right?
- How to speed up this NIntegrate which is calculated many times?
- Seven-dimensional cross product
- Finite projective plane with trivial automorphism group
- How would the wind patterns of a Disc-like-world work?
- Is "Every real number is even" a false statement? Is it a statement at all?
- Expected Cards Left When One Color Is Exhausted
- Rate of Difference of Gaussian Error
- Writing a visually-selected couple of files out to a file with an open buffer
- Does the concept of information presuppose sentience?
- Is the six million dollar hut challenge real?
- An SF novel where a very young child escapes being murdered by hiding in the water tank of a toilet
- What are ways to prevent overly long ballots?
- Help distinguishing between statistics in Mixed Model output table
- lilypond notenames and vertical spacing
- How to format an epigraph from a film
- How to get the index of a point with specific attribute values (using geometry nodes)
- Sci-fi novel human-centered, with alien empire using stargates, humans try to avoid overruling
- What did Chava say to Adam?
- iOS Safari bookmark and copied-to-clipboard URLs mismatch
- Has the Silver Surfer's clothing (or lack thereof) ever been addressed in the comics?
- Khovanskii's theorem in nilpotent groups?
- Unable to mount ISO via iDRAC remoteimage2 despite successful ping and direct download
- What is this under cabinet lamp style? Are they easily convertible to LED?