Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Posts tagged math

This tag doesn't have any usage information yet.

This tag doesn't have a detailed wiki yet.

64%
+7 −3
Challenges Make $2 + 2 = 5$

In this challenge, add 2 integers, but if both the integers are 2, output 5. Shortest code in each language wins! Example ungolfed program in Python 3.x def add(x, y): if x == 2 and y == 2: ...

23 answers  ·  posted 3y ago by General Sebast1an‭  ·  last activity 9d ago by arutonee‭

Question code-golf math number
71%
+3 −0
Challenges Expand a polynomial

Challenge Given the roots of a polynomial (that is, the $x$ values where the polynomial evaluates to zero), as an array of real numbers, return the polynomial's coefficients. That is, given real ...

4 answers  ·  posted 3y ago by Moshi‭  ·  last activity 1mo ago by Moshi‭

Question code-golf math
60%
+1 −0
Sandbox Product of polynomials modulo 2 in integer representation

posted 2mo ago by celtschk‭  ·  edited 2mo ago by celtschk‭

Article code-golf math
50%
+0 −0
Sandbox 3D compass point from 3D coordinates

posted 2y ago by trichoplax‭  ·  edited 2mo ago by trichoplax‭

60%
+1 −0
Sandbox Plain ​​spheres

posted 5mo ago by trichoplax‭  ·  edited 2mo ago by trichoplax‭

83%
+8 −0
Challenges The 50 substrings that validate any string of Roman numerals

Given a string of Roman numerals, decide whether it forms a valid Roman number. If not, output the substring that proves this, from the list of 50 strings described below. Relevant fact This chal...

7 answers  ·  posted 9mo ago by trichoplax‭  ·  edited 2mo ago by trichoplax‭

50%
+0 −0
Challenges Multiplicative perfection

Given a positive integer, indicate whether it is the product of its proper divisors. Integers equal to the product of their proper divisors can be found on the Online Encyclopedia of Integer Seque...

4 answers  ·  posted 2mo ago by trichoplax‭  ·  last activity 2mo ago by celtschk‭

50%
+0 −0
57%
+2 −1
Challenges Fibonacci without consecutive digits

Output the Nth number in the list of Fibonacci numbers that have no consecutive digits. Input A non-negative integer (if you treat the Fibonacci numbers as zero-indexed) or a positive integer (...

4 answers  ·  posted 10mo ago by trichoplax‭  ·  last activity 3mo ago by Andrew Ray‭

60%
+1 −0
Challenges Hex ​​​detector

Given an integer from 1 to 1000, indicate whether it is a centered hexagonal number[1] (also known as a hex number). What is a hex number? The hex numbers can be visualised as follows: On a he...

4 answers  ·  posted 5mo ago by trichoplax‭  ·  last activity 3mo ago by trichoplax‭

Question code-golf math number
66%
+2 −0
Challenges Substring factor

Does a positive integer have a substring as a factor? Input A positive integer. Output One of 2 distinct values to indicate whether the input has a factor that is a strict substring of it...

3 answers  ·  posted 5mo ago by trichoplax‭  ·  last activity 4mo ago by Shaggy‭

66%
+2 −0
Sandbox Net​​ or​​ not? [FINALIZED]

posted 4mo ago by trichoplax‭  ·  edited 4mo ago by trichoplax‭

50%
+0 −0
Challenges Net​​ or​​ not?

Given a hexomino, indicate whether it is a net of a cube. Input A 6 by 6 grid containing exactly 6 filled squares. The 6 filled squares will be in a single edge connected set (a hexomino). Th...

0 answers  ·  posted 4mo ago by trichoplax‭

Question code-golf math
50%
+0 −0
Sandbox Substring factor [FINALIZED]

posted 5mo ago by trichoplax‭  ·  edited 5mo ago by trichoplax‭

60%
+1 −0
Challenges Most isolated of 3 points

Given 3 points, output one that is separated from its nearest neighbour by the largest distance. Input 3 distinct points (that is, no 2 points are in the same position). Each point is a pair o...

0 answers  ·  posted 5mo ago by trichoplax‭  ·  edited 5mo ago by trichoplax‭

Question code-golf math number
60%
+1 −0
Sandbox Most isolated of 3 points [FINALIZED]

posted 5mo ago by trichoplax‭  ·  edited 5mo ago by trichoplax‭

50%
+0 −0
Sandbox Hex ​​​detector [FINALIZED]

posted 5mo ago by trichoplax‭  ·  edited 5mo ago by trichoplax‭

50%
+0 −0
Challenges Rationalise recurring binary

Given a potentially recurring binary string, output the number it represents, as a fraction in lowest terms. The notation used in this challenge for recurring digits is non-standard. An r is used ...

0 answers  ·  posted 2y ago by trichoplax‭  ·  edited 6mo ago by trichoplax‭

66%
+2 −0
Challenges Round trip stones

$N$ vessels initially contain $3$ stones each. What is the probability of having at least $3$ stones in the first vessel after moving a uniformly random selection from the first vessel to the secon...

1 answer  ·  posted 8mo ago by trichoplax‭  ·  last activity 7mo ago by Arpad Horvath‭

50%
+0 −0
Sandbox Round trip stones [FINALIZED]

posted 8mo ago by trichoplax‭  ·  edited 8mo ago by trichoplax‭

62%
+3 −1
Challenges Print the modular multiplicative inverse / virtual fractions

Goal Print the modular multiplicative inverse with a modulus of 65536 (or a higher exponent of 2) for odd numbers 1-97. Example output Print these values (or an extension of them): 1 43691 52...

1 answer  ·  posted 10mo ago by H_H‭  ·  last activity 9mo ago by isaacg‭

Question code-golf math
50%
+0 −0
66%
+2 −0
Challenges Borromean coprimes

Given 3 positive integers, indicate whether they are Borromean coprimes. Definition 3 positive integers are called Borromean coprimes if both of the following are true: Their greatest common d...

2 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by NikNakk‭

Question code-golf math
60%
+1 −0
Sandbox Borromean coprimes [FINALIZED]

posted 1y ago by trichoplax‭  ·  edited 1y ago by trichoplax‭

75%
+4 −0
Challenges Probability of rolling all 6 dice faces

The probability of rolling every number from 1 to 6 with $N$ six-sided dice. Input A positive integer $N$. Your code must work for inputs up to and including 10, but may crash, error, or give ...

4 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by RubenVerg‭

Question code-golf math dice
66%
+2 −0
Challenges Expected value of highest dice rolled

You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score? Input A positive integer ...

2 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by RubenVerg‭

Question code-golf math dice
60%
+1 −0
66%
+2 −0
60%
+1 −0
71%
+3 −0
71%
+3 −0
Sandbox Add two negabinary integers [FINALIZED]

posted 3y ago by Moshi‭  ·  edited 1y ago by trichoplax‭

83%
+8 −0
Challenges Compute the determinant

Challenge A simple challenge: Given a two-dimensional matrix (an array of arrays) of real numbers, compute the determinant. The determinant of a matrix is a mathematical construct used in many ap...

9 answers  ·  posted 3y ago by Moshi‭  ·  last activity 1y ago by aspen138‭

Question code-golf math
71%
+3 −0
Challenges Presumptuous base conversion

Take an input string representing a number and convert it to decimal (base 10). However, the base of the input is not specified. Assume the input is in the smallest base for which its digits are va...

5 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by Shaggy‭

71%
+3 −0
Challenges Make a frequency table (histogram)

Challenge Given an array in any suitable format, create a frequency table for it. i.e: Pair each unique element with the number of times it appears in the array. You can return the frequency tabl...

10 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by Moshi‭

Question code-golf math
81%
+7 −0
Challenges Find n Niven Numbers

Challenge A Niven number is a positive integer which is divisible by the sum of its digits. For example, 81 -> 8+1=9 -> 81%9=0. Your task is to find the first n Niven numbers, given n. Te...

7 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by Shaggy‭

66%
+6 −2
Challenges Multiply complex numbers.

Multiply complex numbers. 2 space-seperated ones will be input, as follows: (update: you can replace i with j or some other symbol if needed) a+bi -a+bi a-bi -a-bi where a and b are integers ...

7 answers  ·  posted 3y ago by heav‭  ·  last activity 2y ago by __blackjack__‭

Question code-golf math
81%
+7 −0
Challenges Evens or Odds - you know this one

Get ready for a comparatively dry question - this is intended to be one of the "the"s of the code-golfing dictionary. Create a program which inputs a base 10 non-negative whole number (without lea...

16 answers  ·  posted 3y ago by AndrewTheCodegolfer‭  ·  last activity 2y ago by Olin Lathrop‭

50%
+0 −0
83%
+8 −0
Challenges Solve Goldbach's Conjecture

Goldbach's Conjecture states that every even whole number greater than 2 is the sum of 2 prime numbers. Your task is to return those 2 prime numbers, given an even whole number as input. There are ...

10 answers  ·  posted 4y ago by Quintec‭  ·  last activity 2y ago by torres‭

Question code-golf math
81%
+7 −0
Challenges Collatz conjecture; Count the tries to reach $1$

Background Check out this video on the Collatz conjecture, also known as A006577. If you don't know what this is, we're given an equation of $3x + 1$, and it is applied this way: If $x$ is odd...

15 answers  ·  posted 3y ago by General Sebast1an‭  ·  last activity 2y ago by torres‭

Question code-golf math number
85%
+10 −0
Challenges It's Hip to be Square

Challenge A catalogue type challenge that simply asks: Given an integer n (where n>=0) as input return a truthy value if n is a perfect square or a falsey value if not. Rules You may take...

20 answers  ·  posted 3y ago by Shaggy‭  ·  last activity 2y ago by Zakk‭

66%
+2 −0
Sandbox Create a finite projective plane of order $n$

posted 3y ago by user‭  ·  edited 3y ago by user‭

Article code-golf math
81%
+7 −0
Challenges Operation "Find The Operator"

Challenge Make a program that takes input of 3 non-negative integers: a result and 2 other values that once calculated results to the 3rd value. The program must figure out how to get the 2 fir...

5 answers  ·  posted 3y ago by General Sebast1an‭  ·  last activity 3y ago by radarek‭

Question code-golf math number
88%
+13 −0
Challenges Evaluate a single variable polynomial equation

Challenge Given a list of n numbers and x, compute $a + bx^1 + cx^{2} + ... + zx^{n-1}$, where a is the first value in the list, b is the second, etc. n is at most 256 and at least 0. The input va...

20 answers  ·  posted 4y ago by moony‭  ·  last activity 3y ago by south‭

Question code-golf math
66%
+2 −0
Challenges Define a mathematical expression in English

Background Inspired by this challenge that is also a mathematical English translator. Challenge Write a program that translates a mathematical expression using English with the following specifi...

1 answer  ·  posted 3y ago by General Sebast1an‭  ·  edited 3y ago by General Sebast1an‭

Question code-golf math string
75%
+4 −0
Sandbox Expand a polynomial [FINALIZED]

posted 3y ago by Moshi‭  ·  edited 3y ago by Moshi‭

60%
+1 −0
Challenges Getting perfect squares, differently

Create a program that gets all perfect squares starting from 0 or 1 without using any methods of multiplication (repetitive addition) and exponentiation (repetitive multiplication). Output them for...

7 answers  ·  posted 3y ago by General Sebast1an‭  ·  last activity 3y ago by General Sebast1an‭