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

learn more… | top users | synonyms

19
votes
6answers
390 views

Approximate ∫((e^x)/(x^x))dx

You are to approximate the value of: Where your input is I. Rules You may not use any built-in integral functions. You may not use any built-in infinite summation functions. Your code must ...
8
votes
2answers
129 views

Efficient Scientific Notation

The other day my chemistry teacher was explaining to us about scientific notation (using a small number and multiplying it by powers of ten to express large numbers more easily), which brought me back ...
17
votes
8answers
276 views

Print the Super Collatz numbers

The Collatz Sequence (also called the 3x + 1 problem) is where you start with any positive integer, for this example we will use 10, and apply this set of steps to it: if n is even: Divide it by ...
-7
votes
1answer
93 views

Infinitely large addition [closed]

You will be given two positive integers of any length, and you are supposed to add them and output the result to the screen or to a file. No additional input will be given and no additional output is ...
6
votes
2answers
144 views

Find the nth base-b digit of (b^k-1)^-2

Task Your task is simple. Write a program or function which takes three positive integer arguments n, k, and b in any order, such that 2 ≤ b ≤ 36, and returns or outputs the nth (1-indexed) base-b ...
-2
votes
0answers
49 views

Find the factorial in pure standard C [duplicate]

char *factorial(const char *); The above is the prototype of the function to be implemented. The argument is the base-10 null-terminated string of n in n!, and the function returns a pointer to the ...
19
votes
15answers
1k views

Hypercube elements

Write a function or program that outputs the number of each type of element (vertex, edge, face, etc.) of an N-dimensional hypercube. As an example, the 3 dimensional cube has 1 cell (i.e. 1 ...
16
votes
14answers
865 views

Find the Cross Product

The cross product of two three-dimensional vectors a and b is the unique vector c such that: c is orthogonal to both a and b The magnitude of c is equal to the area of the parallelogram formed by a ...
18
votes
12answers
1k views

What's the point?

Write a program or function that takes in two integers that represent the X and Y coordinates of a point on a Cartesian plane. The input may come in any reasonable format as long as the X value comes ...
35
votes
17answers
1k views

Print the N-bonacci sequence

This isn't very widely known, but what we call the Fibonacci sequence, AKA 1, 1, 2, 3, 5, 8, 13, 21, 34... is actually called the Duonacci sequence. This is because to get the next number, you sum ...
24
votes
44answers
3k views

Construct the Identity Matrix

The challenge is very simple. Given an integer input n, output the n x n identity matrix. The identity matrix is one that has 1s spanning from the top left down to the bottom right. You will write a ...
-7
votes
1answer
132 views

Generate Euler's Number without using ANY modules/libraries using only powers of 10 [closed]

To complete this challenge: Generate Euler's Number to 0.001 precision (2.718) Avoid any method that uses a pregenerated constant (like math.e or math.pi) The only integers that are allowed to be ...
-2
votes
0answers
119 views

Calculate the Cross Product [duplicate]

This challenge is very simple and I'm surprised that it hasn't been done before. You just have to calculate the cross product of two 3D input vectors. The formula for the cross product is given by: ...
-9
votes
2answers
131 views

Longest output in 1024 bytes or less [duplicate]

Your job is to generate the largest output in a program with 1024 bytes or less. Rules: Only finite lengths allowed Must be completely self-contained and deterministic In particular, standard ...
3
votes
1answer
126 views

Equivalence classes on the Transitive Closure of a Reflexive Relation

The goal of this challenge is to compute the set of equivalence classes over the transitive closure of a symmetric, reflexive relation. For those who don't know what that means, here is a brief ...
35
votes
13answers
4k views

Look, up in the sky! It's a super duper array!

Inspired by this question from our rivals friends over at Code Review. Definitions A super array is an array where each new element in the array is larger than the sum of all the previous elements. ...
11
votes
1answer
256 views

A register calculator challenge

A simple register calculator This challenge involve a simple register calculator that works in the following way: It has some registers named A,B,C,...,Z, each of them can contain an integer, they ...
12
votes
2answers
271 views

Irreducible polynomials over GF(5)

A polynomial with coefficients in some field F is called irreducible over F if it cannot be decomposed into the product of lower degree polynomials with coefficients in F. Consider polynomials over ...
7
votes
6answers
314 views

Inverse symbolic calculator

This challenge is based on the idea of Plouffle's Inverter. Write a program in any language that does the following: Takes as input a non-negative rational number X written in decimal, for example ...
11
votes
1answer
145 views

Calculate the Number, Divisors Edition

Inspired by this question over on Math. Let the prime factorization of a number, n, be represented as P(n) = 2a x 3b x 5c x .... (Using x as the multiplication symbol.) Then the number of divisors of ...
21
votes
10answers
773 views

Compute the multinomial coefficient

Time for another easy challenge in which all can participate! The multinomial theorem states: The expression in parentheses is the multinomial coefficient, defined as: Allowing the terms ki to ...
20
votes
3answers
421 views

Putting square pegs into square holes

I was intrigued by the design of this graphic from the New York Times, in which each US state is represented by a square in a grid. I wondered whether they placed the squares by hand or actually found ...
12
votes
5answers
325 views

Mathematical substitution

Sometimes it is useful to run a math problem with multiple inputs. The goal of this challenge is to make a program that eases this task. Number-generating expressions You must support 3 types of ...
8
votes
4answers
398 views

Counting orthogonal circulant matrices

Two rows of a matrix are orthogonal if their inner product equals zero. Call a matrix with all rows pairwise orthogonal an orthogonal matrix. A circulant matrix is one where each row vector is rotated ...
15
votes
1answer
138 views

Finding Exclusive Area in Circle Intersections

Here's a deceptively challenging geometry puzzle for you! Given a circle A, and n other circles B[n], find the total area contained within A that is not within any circle of B. Your code should be ...
39
votes
24answers
4k views

Superstitious hotel elevator

Description Here's a very superstitious hotel elevator in Shanghai:                 It avoids the number 13, because ...
-6
votes
11answers
141 views

Hexadecimal of a character

Given a unicode character C (or the first character of a string input), output that character's hex representation. Case does not matter. The output ranges from \u0000 to \u9999. Test cases A => ...
1
vote
2answers
154 views

Find the sequence

The purpose of this challenge is to find the general term of a given arithmetic or geometric sequence. Explanation The formula for an arithmetic sequence is as follows an = a1 + (n-1)d where a1 ...
32
votes
25answers
3k views

The Rien Number

The Champernowne constant is a number that is constructed by concatenating the first n numbers, with n tending to infinity. It looks something like this: ...
6
votes
1answer
170 views

Implement Multiplicative Fuzzy Logic

Inspired by this excellent challenge (from which the bulk of this text is blatantly duct-taped) – and my highschool philosophy project... I define the following operators: Fuzzy Conjunction a ×F b ...
17
votes
8answers
651 views

Sort a concatenated sequence

Consider a sequence based on recurrence relations, f(n) = f(n-1)+f(n-2), starting with f(1) = x1, f(2) = x2. For x1 = 2, x2 = 1, the sequence begins like this: 2 1 3 4 7 11 18 29 47 76 123 ...
17
votes
4answers
495 views

A simple DNA simulator

Your code is going to generate a very simple ASCII-art representation of DNA, forever. It will take two numbers as input in any format you want: as a list, as arguments to a function, on stdin, etc. ...
20
votes
22answers
1k views

Convert a number to Hexadecimal

Challenge Here's a simple one. Write a function or program when given a number in base 10 as input, it will return or print that number's value in Hexadecimal. Examples 15 -> F 1000 -> 3E8 ...
12
votes
4answers
440 views

Computing the entropy

Input A matrix M represented as two space separated lines of integers. Each line will have the same number of integers and each integer will be either -1 or 1. The number of integers per line will ...
14
votes
1answer
277 views

Do the Chain Rule

We've had a lot of challenges on differentiation and integration, but none on just solving related rates problems. So in this challenge, you will get a bunch of derivatives (They will be numeric, not ...
20
votes
17answers
2k views

Diamond Puzzles!

Explanation: Last year in math class, on homework we would occasionally get these extremely simple, although equally annoying questions called diamond puzzles. These were basically questions where we ...
16
votes
3answers
289 views

The Abelian Orders

Some background In math, a group is a tuple (G, •) where G is a set and • is an operation on G such that for any two elements x and y in G, x • y is also in G. For some x, y, z in G, basic group ...
22
votes
15answers
910 views

Co-primality and the number pi

Introduction Number theory is full of wonders, in the form of unexpected connections. Here's one of them. Two integers are co-prime if they have no factors in common other than 1. Given a number N, ...
14
votes
5answers
125 views

Properties of Binary Functions

Many important topics in abstract algebra involve a binary function acting on a set. A number of properties of such functions have been defined in the investigation of such topics. Your challenge ...
12
votes
9answers
743 views

Pentagonal numbers made from pentagonal numbers

Introduction A pentagonal number (A000326) is generated by the formula Pn= 0.5×(3n2-n). Or you can just count the amount of dots used: You can use the formula, or the gif above to find the first ...
5
votes
2answers
175 views

Convolve integers in subquadratic time

An linear discrete convolution is an operation that turns two vectors of numbers into a third vector of numbers by multiplying elements inside-out. Formally, for two vectors a and b with elements 0 to ...
15
votes
19answers
2k views

Shorten an already short mathematical expression

For once, I was doing some real work, updating old code, and bumped into an expression that is equivalent to what would be written as πx + ex in good old-fashioned math. I thought it would be possible ...
10
votes
1answer
104 views

Which finite abelian group is this?

Description Write a function f(m, G) that accepts as its arguments a mapping m, and a set/list of distinct, non-negative integers G. m should map pairs of integers in G to new integers in G. (G, m) ...
31
votes
6answers
1k views

Have you been nice this year?

Introduction Santa has too many names to process, and needs your help! He needs you to write a program or a function, which outputs nice, naughty, very naughty or very very naughty. To determine how ...
30
votes
16answers
1k views

Hexadecimal and the Alphabet

In this challenge, you will receive an input, convert it to hexadecimal, make a couple changes, and output the result. Because they are only 16 characters in hexadecimal, your code will need to be as ...
28
votes
16answers
2k views

How much present did you get for Christmas?

Yes, how much, not how many... As we all know, a large present is far better than a small one. Therefore, the value of the presents should always be measured in total volume, not number of presents, ...
28
votes
17answers
1k views

Find the number in the Champernowne constant

Introduction In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on. You can see that the ...
15
votes
5answers
253 views

Cofactor Matrices

The cofactor matrix is the transpose of the Adjugate Matrix. The elements of this matrix are the cofactors of the original matrix. The cofactor (i.e. the element of the cofactor matrix at row i and ...
20
votes
3answers
643 views

Symbolic Integration of Polynomials

Apply an indefinite integral to a given string. The only rules you will be using are defined as such: ∫cx^(n)dx = (c/(n+1))x^(n+1) + C, n ≠ -1 c, C, and n are all constants. Specifications: You ...
17
votes
8answers
648 views

Novel Prime Factors of Repunits

The Background Folks were talking prime factorization in chat and we found ourselves talking about repunits. Repunits are a subset of the numbers known as repdigits, which are numbers consisting of ...