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

learn more… | top users | synonyms

4
votes
3answers
120 views

CAPTCHA Modified by Evil Mathematician

CAPTCHA Modified by Evil Mathematician I accidentally incurred the wrath of an eccentric passive-aggressive mathematician. As part of his demented idea of payback, he modified the CAPTCHA system on ...
19
votes
10answers
877 views

Sort a number's divisors by prime factorization

Given an input of an integer ≥ 2, output a list of its divisors sorted by the exponents in their prime factorizations, in ascending order, ordering first by the largest prime, then by the second ...
21
votes
19answers
1k views

Interquartile Mean

Task Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean. One possible algorithm Discard the lowest and highest ...
6
votes
1answer
116 views

Low pass filter

The goal of this challenge is to implement a digital low-pass filter. You are free to implement any type of digital filter you want, however whatever results produced must pass the validation script ...
3
votes
0answers
104 views

Help the poor Cryptographers - DLP Edition

Introduction and Motivation I'm mainly active on Cryptography.SE and as such have already stumbled across the question: "How the hell am I supposed tools like cado-nfs to do stuff!?". They are super-...
24
votes
28answers
1k views

Substring Sum Set

Introduction Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2]. Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array: ...
16
votes
64answers
2k views

Divisibility test

Task Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd. You may write a program or a function ...
24
votes
24answers
3k views

Calculate the Super-Logarithm

This should be a simple challenge. Given a number n >= 0, output the super-logarithm (or the log*, log-star, or iterated logarithm, which are equivalent since n is never negative for this ...
19
votes
17answers
5k views

Dijkstra's Challenge

Presented in honor of APL as an interactive tool turning 50 this year Background Ken [Iverson] presented his paper Formalism in Programming Languages in August 1963 at a Working Conference on ...
9
votes
6answers
194 views

Binary Recurrence Sequences

A binary recurrence sequence is a recursively-defined sequence of the following form: This is a generalization of the Fibonacci (x = 1, y = 2, a = [1, 1], alpha = 1, beta = 1) sequence and the ...
14
votes
5answers
392 views

Visualize a Difference Pyramid

A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array 2 5 4 9 3 4 Now,...
18
votes
8answers
1k views

Generate the Rummy Sequence

Your task is to take an input n and output element n of the Rummy Sequence, a sequence which I made (looking on OEIS will not help you). Definition Each element of the Rummy Sequence is a set of ...
14
votes
8answers
840 views

Find numbers within the Copeland–Erdős constant

Background The Copeland–Erdős constant is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is 0.23571113171923293137414... See also OEIS A033308. ...
33
votes
26answers
8k views

Fibonacci reversed!

Introduction We all know and love our Fibonacci sequence and have seen a myriad of challenge on it here already. However, we're still lacking a very simple case which this answer is going to provide: ...
18
votes
6answers
492 views

Recognize mod-folds

Task Define a mod-fold as a function of the form f(x) = x % a1 % a2 % … % ak, where the ai are positive integers and k ≥ 0. (Here, % is the ...
29
votes
13answers
2k views

Stock Time Machine

Stock Time Machine You've gained access to a dataset, tomorrowStocks, which contains the stock prices from your favorite business on the NASDAQ. This dataset is a container indexed by minutes past ...
26
votes
20answers
3k views

Calculate A190810

Your task is pretty simple, calculate the n-th element of A190810. Elements of A190810 are calculated according to these rules: The first element is 1 The sequence is increasing If x occurs in the ...
6
votes
6answers
779 views

Is case sensitivity important? Part II: reality check

In this question Tom learned that, in general, there are many motivations to choose to include case sensitivity in his programming language, because the possible combinations for a variable name are ...
19
votes
11answers
965 views

Return the nth digit of the sequence of aliquot series

0. DEFINITIONS A sequence is a list of numbers. A series is the sum of a list of numbers. The set of natural numbers contains all "non-negative integers greater than zero". A divisor (in this ...
17
votes
14answers
1k views

Narayana-Zidek-Capell numbers

Generate the nth Narayana-Zidek-Capell number given an input n. Fewest bytes win. f(1)=1, f(n) is the sum of the previous floor(n/2) Narayana-Zidek-Capell terms. Test Cases: f(1)=1 f(9)=42 f(14)=...
13
votes
11answers
2k views

Is case sensitivity important?

Tom is going to implement a new programming language of his invention. But before actually starting working on it, he wants to know whether his language should be case sensitive or not. On one hand, ...
17
votes
10answers
655 views

The Camouflage Color Changing Chameleon Challenge

Chameleon challenges are a bad thing, apparently. Too bad, chameleons are beautiful creatures. Time for a change! As we all know, many chameleons posses a remarkable ability to blend in with their ...
14
votes
2answers
237 views

Normal sentences

Write a program or function which, given an input string and a standard deviation σ, outputs that string along the normal distribution curve with mean 0 and standard deviation σ. Normal distribution ...
34
votes
59answers
6k views

Print a bunch of uninteresting numbers!

An uninteresting number (which I totally didn't make up only for this challenge) is created like this: Take a positive integer N Create a new number O by adding the digits of N at the end of ...
23
votes
2answers
1k views

Compute the maximum number of runs possible for as large a string as possible

[This question is a follow up to Compute the runs of a string ] A period p of a string w is any positive integer p such that w[i]=w[i+p] whenever both sides of this equation are defined. Let per(...
23
votes
12answers
4k views

Find the nth decimal of pi

There are already 30 challenges dedicated to pi but not a single one asks you to find the nth decimal, so... Challenge For any integer in the range of 0 <= n <= 10000 display the nth decimal ...
3
votes
0answers
114 views

Convert to and from signed octal [closed]

Write some code to do the following: Take as its input a signed integer in either signed decimal or signed octal (explained below) If the number is decimal convert it to octal. If it's octal, ...
15
votes
15answers
948 views

Calculate the partitions of N

Your challenge is simple: GIven an integer N, ouput every list of positive integers that sums to N. For example, if the input was 5, you should output [1, 1, 1, 1, 1] [1, 1, 1, 2] [1, 1, 3] [1, 2, 2]...
12
votes
1answer
2k views

Prove me wrong!

Introduction Your mission in life is simple: Prove people wrong on the internet! To do this you usually carefully analyze their statements and point out the contradiction in them. It's time to ...
44
votes
14answers
4k views

Knight on the Rim is Grim

Introduction Aron Nimzowitsch was a leading chess master and a influential chess writer. In his book 'My System', the first chapter deals about the importance of the center and why you should ...
8
votes
8answers
971 views

Fred's water bill

Fred is a quasi-friendly guy, but in reality he is mean. Because of this, Fred lives alone in a small apartment in Los Altos, CA. Fred is so mean because he is very particular about water. He, ...
22
votes
14answers
2k views

Simplify a square root

Given a positive integer n, simplify the square root √n into the form a√b by extracting all square factors. The outputted a,b should be positive integers with n = a^2 * b with b as small as possible. ...
13
votes
11answers
2k views

I only pay with dollars

As the title -- although discretely -- hints, I only pay with dollars. The challenge Write a function/program that takes a string as input, which is a monetary value preceded by a symbol. ex) £4.99....
9
votes
10answers
325 views

Derivative at the Edge

My preferred way to approximate a derivative is the central difference, its more accurate than forward difference or backward difference, and I'm too lazy to go higher-order. But the central ...
10
votes
2answers
307 views

Prove that a Number is Algebraic

Inspired by this answer (emphasis mine): We will play a game. Suppose you have some number x. You start with x and then you can add, subtract, multiply, or divide by any integer, except zero. You ...
18
votes
26answers
2k views

Count Up, Replace, Repeat!

Definition Define the nth array of the CURR sequence as follows. Begin with the singleton array A = [n]. For each integer k in A, replace the entry k with k natural numbers, counting up from 1 to k....
7
votes
4answers
237 views

Count, Replace, Add Up! [duplicate]

Definition Define the nth term of the CRAU sequence as follows. Begin with the singleton array A = [n]. Do the following n times: For each integer k in A, replace the entry k with k natural ...
29
votes
37answers
2k views

Difference of the square of the sum

Find the difference between the square of the sums and sum of the squares. This is the mathematical representation: (∑n)^2-∑n^2 Your program/method should take two inputs, these are your lower ...
16
votes
9answers
946 views

g​o​l​f​ ​a​t​a​n​2

Sometimes it really is a struggle to convert cartesian coordinates (x,y) to polar coordinates (r,phi). While you can calculate r = sqrt(x^2+y^2) quite easily, you often need some distinction of cases ...
6
votes
11answers
314 views

Parity of Nth Term in Fibonacci Integer Sequences

If you look at the Fibonacci Numbers, you will notice a pattern in their parity: 0, 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144. Every three numbers is even, and all the others are odd. This ...
23
votes
4answers
677 views

Rotate a hypercube

Introduction A hypercube/tesseract is the 4 dimensional equivalent of a normal cube. It's made by taking a cube net, extending it to the 3rd dimension, then – using the 4th dimension – folding it ...
2
votes
0answers
51 views

Does the triangle contain the origin? [duplicate]

Challenge description On a Cartesian plane, a triangle can be described as a set of three points, each point being one of the triangle's vertices. For instance, coordinates (2, 1), (6, 8), (-7, 3) ...
15
votes
12answers
1k views

“Bit-borrow” two numbers

Did you know that a small number can borrow bits from a larger number? Here's an example. Let's say our two numbers 5 and 14. First, write them out in binary: 5 14 000101 001110 First we ...
6
votes
1answer
189 views

Golf the Inverse of Exponential Generating Function

Earlier, we talked about exponential generating functions (e.g.f.). Task You will take a few terms of a sequence. Your task is to find another sequence with that many terms, whose e.g.f., when ...
13
votes
13answers
780 views

Golf the Sequence whose Exponential Generating Function is tangent

Almost every function can be expressed as a polynomial with infinite terms. For example, e^x = 1 + x + x^2/2! + x^3/3! + x^4/4! + ... For example, sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... The ...
30
votes
22answers
2k views

Leyland Numbers

Given a natural number n, return the n-th Leyland number. Leyland Number Leyland numbers are positive integers k of the form k = x^y + y^x Where x,y are integers strictly greater than 1. They ...
2
votes
29answers
4k views

The handshake problem

The handshake problem is the classic problem that for n people in a room, if they all shake hands, what's the total number of handshakes that occur. You code should take an input of any number and ...
35
votes
28answers
7k views

Weapons of Math Instruction

Last time when I tried to come up with something easy that wasn't a duplicate, it ended up being way too hard.. So hopefully this time it's indeed something newcomers can try as well. Input: An ...
28
votes
15answers
3k views

Turn an Array into a Math Problem

Given a nonempty list of nonnegative integers, consider rewriting it as an arithmetic problem where: A plus sign (+) is inserted between pairs of numbers that increase from left to right (a.k.a. ...
5
votes
7answers
321 views

Ain't there nothing up my sleeves

Note: reference to Nothing up my sleeve number. Your task is to take no input and generate this exact output: d76aa478 e8c7b756 242070db c1bdceee f57c0faf 4787c62a a8304613 fd469501 698098d8 ...