For mathematical questions related to programming, and questions where a computer-aided solution is strongly suggested. A strong connection with a mathematical topic is needed to make programming questions on-topic. This should not be the only tag. Consider also using the tags (algorithms), (numerical-methods), or (linear-programming).

# Questions tagged [programming]

594 questions

**36**

votes

**3**answers

### Under the Curry-Howard correspondence or loosely "proofs-as-programs", do we also have "programs-as-proofs" and what would some arb. program prove?

Curry-Howard Correspondence
Now, pick any 5-30 line algorithm in some programming language of choice.
What is the program proving? Or, do we not also have "programs-as-proofs"?
Take the GCD algorithm written in pseudo-code:
function gcd(a, b)
…

Abstract Space Crack

- 19,523
- 5
- 41
- 89

**30**

votes

**6**answers

### Is (a/b)/c equal to a/(b*c) for integer division?

Let $\div$ denote a binary operator that returns the integer quotient of two integers, i.e. (assuming that both integers are positive) $a \div b = \left\lfloor \frac ab \right\rfloor$. This corresponds to the integer division operator in many…

Nithin

- 411
- 4
- 8

**18**

votes

**1**answer

### How to compute the sine of huge numbers

For several days, I've been wondering how it would be possible to compute the sine of huge numbers like 100000! (radians). I obviously don't use double but cpp_rational from the boost multiprecision library. But I can't simply do 100000! mod 2pi and…

Oliver Borchert

- 289
- 2
- 7

**13**

votes

**1**answer

### What's special about the number $1.000000015047466$E+$30$?

I'm a programmer by trade by I've run into a weirdly special number and need some help deciphering its significance.
I was writing some machine learning code that compiles into GPU kernel code and the compiler output the number 1.000000015047466E+30…

Shrey Gupta

- 233
- 6

**9**

votes

**11**answers

### Can exact square roots not be found?

I'm brushing up on some higher level maths for a programming project. I was going along and then I realized that I have absolutely no idea how square roots can be computed.
I mean sure, I've memorized a lot of perfect squares. But I wouldn't be able…

Edward Severinsen

- 301
- 2
- 5

**7**

votes

**2**answers

### Number of $n \to p \bmod n$ before getting to 0

There isn't much background context, but is there any estimations on how many iterations of $n \to p\% n$ are needed before $n$ becomes 0? Percentage sign is modulo. ($p$ is fixed, prime in my context but not sure if it matters).
For example, when…

Gareth Ma

- 1,833
- 4
- 13

**7**

votes

**4**answers

### When the product of a multi-digit integer and its mirror is a palindrome, can the original number have digits greater than $2$?

I am reposting a question I posted on r/mathematics. It was suggested I ask it here.
My son was jotting down some multiplications for school and asked me if there were many numbers that, when multiplied by their mirror image, resulted in a…

Cirrocumulus

- 171
- 1

**7**

votes

**2**answers

### Sum of the first $n$ palindromes

We put together a problem to be solved programmatically, and we know at lower numbers there is a solution to this problem. How would we go about proving whether the below problem has an answer, as our standard computational approaches do not yield a…

user1044220

- 73
- 4

**6**

votes

**2**answers

### Doubling Point Formula of Elliptic Curve is Not Working

Let $E$ be an elliptic curve and a point $P = (x, y) \in E,$ from the duplication formula, the x-coordinate of $2P$ is -
$$x_{(2P)}=(x^4-b_4*x^2-2*b_6*x-b_8)/(4*x^3+b_2*x^2+2*b_4*x+b_6)$$
The formula is given on page $54$ in book The Arithmetic…

Consider Non-Trivial Cases

- 599
- 5
- 21

**6**

votes

**1**answer

### Matt Parker mistake in cannonball stacking video

I could need someone to do a check on this problem, since it has been published in Matt Parkers book "things to make and do in the fourth dimension" and has now been featured in a numberphile video
In Matt Parker's most recent video on numberphile…

Gravrok

- 69
- 3

**6**

votes

**2**answers

### Random tree generation probability problem

Given a tree-structure with a root node, the node can either get zero, one or two children, all with the same probability of 1/3. The children also has the same probability of getting zero, one or two children, which is 1/3. Recursively the…

Anton Lindstrand

- 69
- 2

**5**

votes

**0**answers

### How to draw a planar-embedded graph in a visually pleasing way

I have a graph with two types of vertices: "boundary" vertices have degree 1, and "interior" vertices have degree 4. I've computed a planar embedding of the graph, i.e. around each vertex, I have the list of outgoing edges in (say) clockwise order,…

Joshua P. Swanson

- 9,067
- 13
- 31

**5**

votes

**1**answer

### Is there an OpenSource CAS compatible with GAP where relatively fast computation of Hom$_{kG}(M,N)$ over "large" finite fields is possible?

I'm working in the area of modular representation theory of finite groups ($G$ is a finite group, $p$ is a prime number dividing $|G|$, $k$ is a finite field of characteristic $p>0$, $M$ and $N$ are $kG$-modules). I'm using GAP to do some…

Bernhard Boehmler

- 317
- 4
- 15

**5**

votes

**1**answer

### Random point in a triangle

This subject has already been covered here, and my question is slightly different.
Preliminary warning: i'm quite a noob (and probably will continue to be unless i go back to school), but i do love some maths, the one i can't do with programming.…

Joseph Merdrignac

- 209
- 1
- 5

**5**

votes

**2**answers

### Finding all combinations that sum up to a specific number with given constrains

This is a continuation of this problem. Find all combinations that sum up to a specific number
Think of following values.
T = Target // The value to target. eg 100
I = Items // Number of items that makes T. eg 5
Now Not just like previous question,…

MathPhobia

- 61
- 8