Questions tagged [math]

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

17
votes
6answers
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 ...
4
votes
7answers
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 ...
17
votes
2answers
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 ...
13
votes
9answers
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 ...
9
votes
1answer
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 ...
6
votes
7answers
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 ...
22
votes
15answers
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 ...
24
votes
25answers
2k views

Find a Fixed Point

Given an integer x1 and some black box function f: ℤ → ℤ find a fixed point of f in the ...
2
votes
1answer
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 ...
21
votes
7answers
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 ...
6
votes
4answers
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 ...
12
votes
21answers
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 ...
14
votes
31answers
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 ...
14
votes
27answers
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: ...
0
votes
1answer
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: ...
18
votes
31answers
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. ...
28
votes
35answers
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 ...
20
votes
10answers
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 ...
32
votes
16answers
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 ...
11
votes
9answers
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 ...
6
votes
4answers
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 ...
20
votes
33answers
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 ...
16
votes
23answers
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 ...
-2
votes
6answers
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 ...
13
votes
23answers
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 ...
34
votes
37answers
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 ...
16
votes
32answers
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, ...
22
votes
11answers
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 ...
11
votes
6answers
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 ...
10
votes
17answers
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 ...
8
votes
6answers
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 ...
43
votes
43answers
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. ...
14
votes
8answers
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 ...
23
votes
5answers
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 ...
63
votes
21answers
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 ...
46
votes
76answers
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 ...
21
votes
6answers
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 ...
22
votes
7answers
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 ...
3
votes
1answer
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 ...
10
votes
22answers
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 ...
15
votes
24answers
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] ...
9
votes
60answers
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 <...
9
votes
7answers
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: -----------------------------------...
9
votes
17answers
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 ...
19
votes
3answers
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: ...
9
votes
7answers
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 <...
4
votes
0answers
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 ...
3
votes
2answers
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: ...
17
votes
3answers
486 views

Exponentiation to multiplication to addition

Multiplication between 2 integers can be reduced into a series of addition like so 3 * 5 = 3 + 3 + 3 + 3 + 3 = 5 + 5 + 5 Exponentiation (raising a to the power b)...
9
votes
5answers
371 views

Elliptic system

Introduction Given five points in the plane, your task is to compute the area of the ellipse passing through these points. You can assume that exactly one non-degenerate ellipse can be constructed ...