Questions tagged [math]

The challenge involves mathematics. Also consider using more specific tags: [number] [number-theory] [arithmetic] [combinatorics] [graph-theory] [geometry] [abstract-algebra].

1,284 questions
713 views

Delete the first periodic digit

We all know that whenever a rational number is written in decimal, the result is either terminating or (eventually) periodic. For example, when 41/42 is written in decimal, the result is ...
642 views

Make a Plain PIE!

(2 Jan 2018) Because of the winning criteria I am going to accept the Jelly answer, but I am also giving upvotes to all other answers which all use astounding methods as well Introduction There are ...
651 views

Intersection of two triangles

Given 4 points on the 2D planes A, B, C, D, calculate the area of the intersection region of the triangles OAB and ...
1k views

Characteristic polynomial

The characteristic polynomial of a square matrix A is defined as the polynomial pA(x) = det(Ix-A) where I is the identity matrix and det the determinant. Note that this definition always gives us a ...
440 views

The working time calculator

This is based on how my company deals with the monitoring of the working times for every employee. Each one of us has a card that can be passed in front of a sensor, so that a clock registers the ...
456 views

It's a Slippery Slope

There has not been a challenge regarding slope fields, as a far as I can tell. So, I might as well make one. The challenge Given: A black box function f which ...
1k views

The sequence of self-contained numbers

Let's define a self-contained number as a positive integer, whose digits appear in runs of length equal to themselves only. In other words, any decimal digit d (excluding 0) occurs only in runs of ...
2k views

Find a Fixed Point

Given an integer x1 and some black box function f: ℤ → ℤ find a fixed point of f in the ...
172 views

Advent Challenge 7: Balance the storage carts!

<< Prev Next >> After some careful analysis, Santa was able to determine the dock size ranges and get the presents into the correct transportation dock. Now, he needs you to help him balance ...
2k views

Half-Exponential Function

A half-exponential function is one which when composed with itself gives an exponential function. For instance, if f(f(x)) = 2^x, then ...
255 views

Find the smallest number of participants with resulting percentages

Programs often list outcome statistics, such as this: 54% of participants received an award 69% of participants got a promotion 85% of participants increased their salary These percentages are the ...
2k views

Iterated phi sequence

Related: Iterated phi(n) function. Your challenge is to compute the iterated phi function: f(n) = number of iterations of φ for n to reach 1. Where ...
1k views

2 factors factorization

Given a natural number n write a program or function to get a list of all the possible two factors multiplications that can be used to achieve ...
2k views

Calculate the lowest number where the sum of the sequence of numbers exceeds a given value

Given you have an infinite sequence of numbers defined as follows: ...
151 views

In which number set do I belong? [closed]

Introduction Mathematicians often work with number sets. These are groups of numbers that share common properties. These are number sets are, in order from most specific to most broad: ...
3k views

cool untitled sequence thingy

Let's define fn(k) as the sum of the first k terms of the natural numbers [1, ∞) where each number is repeated n times. ...
3k views

Normalize a Vector

To normalize a vector is to scale it to a length of 1 (a unit vector), whilst keeping the direction consistent. For example, if we wanted to normalize a vector with 3 components, u, we would first ...
1k views

Minimal sparse rulers

A standard ruler of length n has distance marks at positions 0, 1, ..., n (in whichever units). A sparse ruler has a subset of those marks. A ruler can measure the distance k if it has marks at ...
2k views

Different ways of defining primes

One of my favorite definitions of the prime numbers goes as follows: 2 is the smallest prime. Numbers larger than 2 are prime if they are not divisible by a smaller prime. However this definition ...
1k views

BigNum Bakeoff Reboot

Some of you may be familiar with the BigNum Bakeoff, which ended up quite interestingly. The goal can more or less be summarized as writing a C program who's output would be the largest, under some ...
415 views

Compute the Lambert W function

Your challenge is to compute the Lambert W function. The W of x is defined to be the real value(s) y such that y = W(x) if x = y*(e^y) where ...
2k views

Digitangular numbers

A triangular number is a number that can be expressed as the sum of consecutive positive integers, starting at 1. They can also be expressed with the formula ...
1k views

The sequence of range-exponentiated integers

Consider a triangle where the Nth row (1-indexed) is the array of the first N positive integer powers of N. Here are the first few rows: N | Triangle 1 | 1 2 | 2 4 3 | 3 9 27 4 | 4 16 64 256 5 | 5 ...
220 views

The Median of Practically Recreational Languages

According to TIO there are two types of programming languages: Practical (seen in many corporate environments as a development standard). Recreational (if seen in a corporate environment, you're ...
1k views

The cyclic sequence of even digits, with odds in between

Consider the following sequence: 1, 0, 1, 2, 4, 1, 6, 8, 0, 1, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 0, 1, ... The even digits start from 0 and are ...
3k views

Determinant of an Integer Matrix

Given a square integer matrix as input, output the determinant of the matrix. Rules You may assume that all elements in the matrix, the determinant of the matrix, and the total number of elements in ...
2k views

An Array of Challenges #3: Moving Averages

Note: This is #3 in a series of array-manipulation challenges. For the previous challenge, click here. Moving Average of a List The moving average of a list is a calculation resulting in a new, ...
3k views

Bijective function ℤ → ℤⁿ

It is trivially possible to create a bijective function from $\mathbb{Z}$ (the set of all integers) to $\mathbb{Z}$ (e.g. the identity function). It is also possible to create a bijective ...
2k views

LaTeX truth tables

Write a program or a function that accepts the list of outputs from a logic function and outputs the LaTeX code for its truth table. The inputs should be labeled as lowercase letters ...
1k views

Approximate My Squares

Inspired by this video by tecmath. An approximation of the square root of any number x can be found by taking the integer square root ...
574 views

Make an n-Juggler

I've been really interested with sequences that follow the property $a(n+1) = a(n - a(n))$ recently, so here's another question about these sequences. In particular we are concerned with ...
9k views

Implement the iOS 11 Calculator

iOS 11 has a bug that makes the result of 1+2+3 to be 24. This is related to the animation speed, but anyway: The task is to make 1 + 2 + 3 == 24. But only that. ...
588 views

Sum the Vertex Connections

Let's say you have a positive integer N. First, build a regular polygon, that has N vertices, with the distance between neighbouring vertices being 1. Then connect lines from every vertex, to every ...
508 views

Determine How many Wheels There Are

Non-math explanation This is an explanation that is meant to be approachable regardless of your background. It does unfortunately involve some math, but should be understandable to most people with a ...
8k views

Yo boy, must it sum

Every positive integer can be expressed as the sum of at most three palindromic positive integers in any base b≥5.   Cilleruelo et al., 2017 A positive integer is palindromic in a given base if ...
9k views

Is my triangle right?

Given a, b, c the length of the three sides of a triangle, say if the triangle is right-angled (i.e. has one angle equal to 90 degrees) or not. Input Three ...
863 views

Create a universal integer sequence

Definition Let's call an (infinite) integer sequence universal if it contains every finite integer sequence as a contiguous subsequence. In other words, the integer sequence (a1, a2, …) is universal ...
832 views

Output the simplified Goodstein sequence

A number is in base-b simplified Goodstein form if it is written as b + b + ... + b + c, 0 < c ≤ b The simplified Goodstein sequence of a number starts with ...
186 views

Did you hear about alphametics? [duplicate]

Task The letters spell out actual words, but if you replace each letter with a digit from 0–9, it also “spells” an arithmetic equation. The trick is to figure out which letter maps to each digit. All ...
1k views

Exponent of complex numbers

Given two integers, which may be negative, zero, or positive, a and b (taken in any reasonable format, including inputting a ...
2k views

I am greater than you! [duplicate]

Write a function or program that given a list of non negative integers, arranges them such that they form the largest possible number. INPUT [50, 2, 1, 9] ...
1k views

Given an int input n, print out n*reversed(n)

Given an integer n, print out n * reversed(n) reversed(n) is the number you get when you <...
2k views

A train crosses a labeled bridge

Consider a bridge of length B formed by tiles labeled with the digits of the positive integers concatenated. For example, if B was 41, then it would look like this: -----------------------------------...
1k views

Primes in the prime factorisation

I saw another prime challenge coming by in PPCG, and I do love me some primes. Then I misread the introductory text, and wondered what the creative brains here had come up with. It turns out the ...
511 views

Writing rational numbers as ratio of factorials of primes

Note: this challenge has been posted on the sandbox. Introduction This challenge is inspired by 2009 Putnam B1, a problem in an undergraduate mathematics competition. The problem is as follows: ...
806 views

Golf the pseudoprimes!

Introduction / Background In a recent discussion in the crypto chat I was challenged to discuss / help with the Fermat primality test and Carmichael numbers. This test is based on the premise that <...
194 views

Those annoying grasshoppers [closed]

The problem #6 of IMO 2009 reads: Let a 1, a 2, a 3, ..., a n, be distinct positive integers and let T be a set of n-1positive integers not containing a 1+a 2+a 3+...+a n, A grasshopper is to ...
364 views

Golfing Newton's Method

I have the following code which I've written to emulate Newton's method for deriving the square root of a number: ...