CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 20:40:18 GMT
content-type: text/html; charset=utf-8
cf-ray: 965ef376da4b7679-BLR
cf-cache-status: DYNAMIC
cache-control: private
set-cookie: prov=2e642535-586b-441c-8744-98289200f3dc; expires=Mon, 27 Jul 2026 20:40:17 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: b754c7ef-c98b-4330-8df0-3a5f66bb4e5d
x-worker-origin-response-time: 474000000
x-dns-prefetch-control: off
set-cookie: prov=2e642535-586b-441c-8744-98289200f3dc; Path=/; HttpOnly; Domain=stackexchange.com
set-cookie: __cf_bm=4djrhEehBkSiqrsxj.jJMJsoennIH6lvc7VK3Mg9rBk-1753648818-1.0.1.1-mjL4yG1_xQPNaOuemjTabbpmGsVk0g0Z4e.2OozagiDFBaIjQcanYC3CLJzyt68CMDbfDT6em_QqCkcV7nycP_whji5hKQD4BvK5Unx6lZ4; path=/; expires=Sun, 27-Jul-25 21:10:18 GMT; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=kusB0VGtPAgTMSMZk.TsnXyHFCE8DJss4VI8MfyAxp4-1753648818226-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 ExchangeTeams
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
983
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
668
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
460
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
- Are you required to protect trade secrets revealed to you even if you didn't sign an NDA?
- Are classified documents subject to a subpoena in discovery?
- Class for validating code in different Conda environments with PyTorch
- When was thermal expansion in solids first described?
- Does passive DisplayPort-HDMI adapter work with 4K 60Hz, if host supports DP 1.2 and HDMI 1.4?
- What Isp can be gotten from a napthalene (mothball) hot gas thruster? Did it work in space?
- Why legacy paying method for ZKSync?
- Anonymizing a submission for double-blind review
- Math bolder than surrounding text in footnotes
- How to extend an MDF shelf?
- Sci-fi book where aliens make contact, ask humans to transport themselves to nearby portal
- Why did the Holy Spirit send Jesus to the wilderness to be tempted by Satan?
- What is the weight of holy water?
- Is there such a thing as 'aerospace grade software'?
- How do Japanese people understand the reading of a single kanji with multiple readings in their everyday life?
- I don't have enough alive employees to start the day. What now?
- 3D projective transformations on text in LuaMetaFun
- Will an error in two of my published papers affect my PhD thesis evaluation?
- Testing Hypotheses with Limited Data in an Ecological Experiment. How do I approach my data?
- What is the parity of a neutrino?
- What were the two colored keys on a MUPID for?
- Can you identify this aircraft landing at Llanbedr Airfield?
- How to navigate in the Universe's Heat Death
- Were the Fantastic Four the only superheroes on Earth-828 in The Fantastic Four: First Steps?