# math's questions - English 1answer

1.184 math questions.

### -8 XOR reduction bools

19 answers, 295 views code-golf string math
Description : Given a string of space separated binary digits or space separated booleans or an array of binary digits or array of booleans . Your job is to find the xor of each until you end up with ...

### 30 Is this number a factorial?

65 answers, 4.878 views code-golf math number decision-problem
The Task Given a natural number as input, your task is to output a truthy or falsey value based on whether the input is a factorial of any natural number. You can assume that the input number will ...

### 38 Detect heat waves

Background The Royal Netherlands Meteorological Institute defines a heat wave* as a series of at least 5 consecutive days of ≥25°C weather (“summery weather”), such that at least 3 of ...

### 17 Multiply two numbers

111 answers, 5.380 views code-golf math number
Input: Two decimal integers. These can be given to the code in standard input, as arguments to the program or function, or as a list. Output: Their product, as a decimal integer. For example, the ...

### 60 Collatz Conjecture (OEIS A006577)

86 answers, 7.295 views code-golf math
This is the Collatz Conjecture (OEIS A006577): Start with an integer n > 1. Repeat the following steps: If n is even, divide it by 2. If n is odd, multiply it by 3 and add 1. It is proven that ...

### -6 Code Golf: simple way to get min & max

5 answers, 792 views code-golf math string function
You will take a set of input numbers, and output the minimum and maximum of the set. You can either write two programs, with 1 program doing each function, or one combined program. Here's an example ...

### 23 Get the decimal!

23 answers, 1.655 views code-golf math
Task: Your task is, when given three inputs: a numerator n a denominator d another integer, x Create a program/function that finds the xth digit of the number after the decimal place. Specs: The ...

### 3 Mathematical parser [duplicate]

0 answers, 162 views code-golf math number arithematic
Challenge : Given a string representing a mathematical expression return the result Input : A string representing a mathematical expression : '1 + 2 - 3 * (2/3 * 1)'. Output : The result after ...

### 17 Rotational Average

26 answers, 1.337 views code-golf math number-theory
Given an input integer n >= 10, output the average of all deduplicated rotations of the integer. For example, for input 123, the rotations are 123 (no rotation), 231 (one rotation) and 312 (two ...

### -1 Find the longest uninterrupted arc in N dimensions

See similar question for 2D case: Find the longest uninterrupted arc The challenge here is to find the longest uninterruped great circle arc around a unit hypersphere in N dimensions, with a random ...

### 171 Mathematics is fact. Programming is not

47 answers, 27.157 views code-golf string math logic factorial
In mathematics an exclamation mark ! often means factorial and it comes after the argument. In programming an exclamation mark ! often means negation and it comes before the argument. For this ...

### 3 Make Three from One [duplicate]

Given a single digit integer and a three digit integer, output a mathematical formula that uses only the single digit and a given list of operators to equal the three digit integer. Input: A one ...

### 11 Generate a number by using a given list of numbers and arithmetic operators

You are given a list of numbers L = [17, 5, 9, 17, 59, 14], a bag of operators O = {+:7, -:3, *:5, /:1} and a number N = 569. Task Output an equation that uses all numbers in L on the left-hand side ...

### 9 Integer logarithms

44 answers, 2.680 views code-golf math number arithmetic
Given integers N , P > 1 , find the largest integer M such that P ^ M ≤ N. I/O: Input is given as 2 integers N and P. The output will be the integer M. Examples: 4, 5 -> 0 33, 5 -> 2 40, ...

### 5 Find the longest uninterrupted arc

The challenge here is to find the longest uninterruped arc around a unit circle with a random amount of points distributed in random positions around it. Here is a diagram to assist my explanation: ...

### -5 Sum power of digits

19 answers, 220 views code-golf math
Challenge : Given two non-negative integers (X and Y > 1) calculate the sum of digits of their powers . i.e : sum of digits of X ^ Y . Input : Two non-negative integers X and Y Output : The ...

### 24 Sign-Swapping Sums

30 answers, 1.870 views code-golf math combinatorics
Given a nonempty list of positive integers [X, Y, Z, ...], your job is to determine the number of unique values of ± X ± Y ± Z ... For example, consider the list [1, 2, 2]. There are eight possible ...

### Hand made log problems [closed]

0 answers, 103 views code-golf math
Note : If anyone can update this to fix this , plz do Question Find the logarithm of a given number. I/O A number as input along with base n Its logarithm to base n Restrictions No use of ...

### 29 Triangular Lattice Points close to the Origin

12 answers, 1.100 views code-golf math geometry
Background A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid. A triangular lattice ...

The shortest code to pass all possibilities wins. In mathematics, the persistence of a number measures how many times a certain operation must be applied to its digits until some certain fixed ...

### 20 Write out the Thue-Morse sequence

32 answers, 2.467 views code-golf math sequence binary
There's quite a few challenges on this site that ask you to print out a sequence, and this is no exception. (The following explanation of the sequence for this challenge assumes the symbols in the ...

### 19 Golfing out the haters

5 answers, 1.050 views code-golf math arithmetic
The setup: A social network reports the number of votes a post has in two ways: the number of net upvotes (total upvotes - total downvotes), and the % of votes that were upvotes, rounded to the ...

### 7 Golf me the Schlosberg Numbers

22 answers, 1.016 views code-golf math number sequence
Schlosberg Numbers In issue 5 of Mathematical Reflections, Dorin Andrica proposed the problem of characterising the positive integers n such that is an even integer. Eight people submitted ...

### 36 World Big Dosa​

5 answers, 1.537 views code-golf math rational-numbers
You are a talented young chef who has just been offered the position of sous chef at the world's most prestigious Indian restaurant. You have little experience with preparing Indian cuisine, but you'...

### 50 Bringing a pair of integers to equality

11 answers, 2.644 views code-golf math number number-theory
This was inspired by a math problem I saw somewhere on the internet but do not remember where (UPDATE: The original problem was found on the math riddles subreddit with a proof provided that it is ...

### 12 Simple golfing interpreter

25 answers, 1.794 views code-golf math interpreter
Challenge: Your job is to create a simple interpreter for a simple golfing language. Input: Input will be in the form of string separated by spaces. You can replace space separation with what you ...

### -4 Return the highest possible placement value based on the input

53 answers, 731 views code-golf math number
Introduction The challenge itself was something I came across and had to try and figure out for a personal of project of mine. I ended up branching out and asking family members if they could provide ...

### 23 Find real roots of a polynomial

1 answers, 1.062 views code-golf math polynomials
Write a self-contained program which when given a polynomial and a bound will find all real roots of that polynomial to an absolute error not exceeding the bound. Constraints I know that Mathematica ...

### 2 Calculate the Peirce quincuncial projection of the Earth [closed]

0 answers, 120 views code-golf math image-processing
The Peirce quincuncial projection is pretty neat. It actually tessellates the whole plane: Your job is to generate this map projection. To simplify things, you will only need to generate the ...

### 163 Programming Languages Through The Years

In this challenge, users will take turns completeing three fairly simple coding tasks in programming languages that are allowed to be progressively older. The first answer must use a programming ...

### 22 Generate a Walsh Matrix

17 answers, 1.433 views code-golf math matrix
A Walsh matrix is a special kind of square matrix with applications in quantum computing (and probably elsewhere, but I only care about quantum computing). Properties of Walsh matrices The ...

### 16 Numbers x such that x^2 divides 7^x-1

20 answers, 6.096 views code-golf math sequence
Task There is a set of numbers x, such that x^2 divides 7^x-1. Your task is to find these numbers. Given an input of n, the code will print the nth number that follows this rule. Examples 1-index ...

### 16 Nim Multiplication

7 answers, 941 views code-golf math
Background If you do much code golfing, you're likely aware of the bitwise XOR operation. Given two integers, it gives another integer with 1s in the bits where the two inputs differ. So, for ...

### 12 Minimum excluded number

34 answers, 2.569 views code-golf math
This is intended to be an easy, bite-size code-golf. The mex (minimal excluded number) of a finite collection of numbers is the smallest non-negative integer 0, 1, 2, 3, 4, ... that does not appear ...

### 36 What's in my pasta sauce?

1 answers, 585 views code-golf math
Background In France, and probably in the rest of the European Union, any food available for sale must list the ingredients that compose it on its packaging, in weight percentage descending order. ...

### 8 set intersection of two lists

14 answers, 619 views code-golf math
Your goal is to compute the set intersection of two lists of integers. The intersection is defined as the unique un-ordered group of integers found at least once in both input list. Input The input ...

### 67 Output the sign

141 answers, 6.443 views code-golf math number integer
Given a number N, output the sign of N: If N is positive, output 1 If N is negative, output -1 If N is 0, output 0 N will be an integer within the representable range of integers in your chosen ...

### 14 Prime or highest factor

25 answers, 1.996 views code-golf math primes
Challenge: Given an array of non-negative whole numbers numbers in the range of 0 to Infinity, Check whether all of them are primes or not. (You can take input as a string too if you want) Input: ...

### 27 The Pedant's Cosine

33 answers, 4.598 views code-golf math trigonometry calculus
My boss just told me to write a cosine function. Being a good math geek, my mind immediately conjured the appropriate Taylor Series. cos(x) = 1 / 0! - x^2 / 2! + x^4 / 4! - x^6 / 6! + ... + (-1)^k x^(...

### 15 Sum of (at most) 5 primes

10 answers, 1.107 views code-golf math primes
Terence Tao recently proved a weak form of Goldbach's conjecture! Let's exploit it! Given an odd integer n > 1, write n as a sum of up to 5 primes. Take the input however you like, and give ...

### 7 Fast inverse square root

10 answers, 1.523 views code-golf math floating-point
Inspired by http://meta.codegolf.stackexchange.com/questions/547/write-a-code-golf-problem-in-which-script-languages-are-at-a-major-disadvantage question on meta, I've decided to make a question which ...

### 57 Sum of all integers from 1 to n

130 answers, 11.763 views code-golf math number
I'm honestly surprised that this hasn't been done already. If you can find an existing thread, by all means mark this as a duplicate or let me know. Input Your input is in the form of any positive ...

### 8 Ascending Pea Pattern generator

8 answers, 1.883 views code-golf math
For those who are not familiarized with the Pea Pattern, it is a simple mathematical pattern. There are multiple variations of this pattern, but we will focus in one: Ascending Pea Pattern It ...

### 12 Partial Sum of Harmonic Sequence!

25 answers, 1.345 views code-golf math sequence
Definition In Mathematics, Harmonic Sequence refers to a sequence where i.e. the nth term of the sequence equals the reciprocal of n. Introduction In this challenge, given a positive ...

### 10 Product of Digits

13 answers, 756 views code-golf math
For a given positive integer number N, write a complete program to find the minimal natural M such that the product of digits of M is equal N. N is less than 1,000,000,000. If no M exists, print -1. ...

### 19 Basic Calculator

16 answers, 2.532 views code-golf math arithmetic
You must write a program to evaluate a string that would be entered into a calculator. The program must accept input and output the correct answer. For languages that do not have standard input/...

### 35 Print the nth prime that contains n

18 answers, 2.558 views code-golf string math number primes
This question will be a twist on finding the nth prime number. Challenge You must write a program that will take one input n, and output the nth prime number whose decimal representation contains ...

### 40 Goodness Giza Golf!

A "Giza number", also colloquially known as a Timmy Number is any number where the digits represent a pyramid (A134810). For example, "12321" is a giza number because it can be visualized like this: ...

### 3 Draw diagonal positions of me squared

15 answers, 595 views code-golf math ascii-art matrix
Based on the interpretation user @ThePirateBay made from the first version of my own challenge Output diagonal positions of me squared now I challenge you to make ASCII art that draws diagonal lines ...

### 16 Is this a staircase number?

21 answers, 1.802 views code-golf math number decision-problem
Challenge : Check if the given number forms a number staircase or not Input : A integer (greater than 0 and not decimal). NOTE : You can take input as string , array of digits. Output : a truthy /...