1
vote
1answer
47 views

Celsius to Fahrenheit back and forth conversion with rounding.

Recently I've encountered some problem with conversion Celsius and Fahrenheit scales. Let's assume that I have value of 44 degrees in Fahrenheit scale, I convert this to the Celsius which gives me ...
4
votes
2answers
72 views

Accounting for changing radius of a paper roll to always unroll the same amount of paper

So I'm building a Post-Turing Machine that's running a 5-state busy beaver. It has a 300ft roll of receipt paper at each end simulating an infinite tape. Hypothetically the tape is divided into ...
0
votes
1answer
38 views

Algorithm for root function $[2^{n-1}]$

I am attempting to convert this function $[2^{n-1}]$ into a root function to return original value. Thus far all my attempts have ended in abject failure. Base : 1 2 3 4 5 6 7 8 9 Result : ...
-3
votes
1answer
59 views

Maximize $f(p)=(k-p)^2+(p-1)^2$

From a computer algorithms analysis (quicksort), its given that $f(p)=(k-p)^2+(p-1)^2$ is maximized when $p=1, p=k$. But how do they get that?
7
votes
4answers
279 views

Algorithms for “solving” $\sqrt{2}$

The very first words out of my mouth need to be this... "Solving" is the wrong term since I am speaking about irrational numbers. I just don't know which word is the correct word... So that can be ...
0
votes
1answer
74 views

Solving this inequality without trial and error

"What is the smallest value of $n$ such that an algorithm whose running time is $100n^2$ runs faster than an algorithm whose running time is $2^n$ on the same machine?" I know the answer is $n = ...
4
votes
1answer
263 views

The trick to proving trigonometric identities

This question is motivated from the following excerpt from Rational Points on Elliptic Curves by Silverman and Tate: $$\cos \theta = \frac{1 - t^2}{1 + t^2}, \sin \theta = \frac{2t}{1+t^2}$$ ...
2
votes
3answers
76 views

Is there any fast way to get the number of a certain day in a week

I'm realy sorry, if this question is a bit stupid... But this is my first time on mathematics stackexchange. Do you guys now for example, how to know the number of monday in a year?
0
votes
2answers
157 views

Universal Formula for Expanding Brackets

I know how to expand brackets such as the following in general, using the foil or crab-claw methods, but my tutor mentioned that there is a universal formula/algorithm for an expansion. E.g Bracket: ...
0
votes
1answer
86 views

Divide N items into M groups with as near equal size as possible

Im trying to split (say) N pink, fluffy balls into M groups as evenly as possible. Eg: ...
-1
votes
1answer
57 views

what is a general algorithm to find a nonempty integer subset that have integers add up to 0?

what is a general algorithm to compute if a set have nonempty integer subset that have integers add up to 0? i would like to know one with the least tries and the proof of it. Example:{−2, −3, 15, ...
0
votes
1answer
58 views

Non-proportional, inverse algorithm

I'm trying to come up with the correct algorithm for a setting on a meter in my app. Basically, I have a value (lets call it 'x') returned from a source which can be in the range of 0 to 30. As x ...
2
votes
2answers
225 views

Take set of values and change scale [duplicate]

I have a large array of variable-integer keypairs. The integer values range from -5 to 5. I'd like to scale that data to a range of 0 to 2. Logically, -5 would become 0, 0 would become 1 and 5 would ...
4
votes
2answers
187 views

Russian Peasant Method for multiplication

What exactly happens with the remainder in this algorithm? I don't understand why it is "dropped". Example: $$\begin{array}{c} \text{Half}&&\text{Double}&\text{Remainder}\\ \hline ...
1
vote
1answer
106 views

Trying to sort the coefficients of the polynomial $(z-a)(z-b)(z-c)…(z-n)$ into a vector

So I have a factored polynomial of the form $(z-a)(z-b)(z-c)\ldots(z-n)$ for $n$ an even positive integer. Thus the coefficient of $z^k$ for $0 \le k < n$ will be the sum of all distinct $n-k$ ...
1
vote
1answer
58 views

Trivial question on an algebraic equation

I am too rusty in algebra. I have as input in a program numbers a and b. I am trying to find them using the bellow relation: ...
0
votes
0answers
47 views

How are these operations the same? How to convert a multiplication in a different form?

I am reading on a specific operation, how it should be done in order to avoid overflow during multiplication. The operation is: $$( A * \text{state} ) \% M;$$ This is susceptible to overflow. The ...
4
votes
1answer
167 views

How to find out if two solutions are equivalent or different?

Given 5 different numbers ($\in \mathbb N$) in a specific brackets pattern like: $$\left(\left(\left(x_1 + x_2 \right) - x_3\right) \times x_4 \right) / x_5 = \text{result}$$ Only the brackets are ...
0
votes
1answer
82 views

Different solutions under distributive and commutative equivalence

Given 5 numbers: $x_1, x_2, x_3, x_4, x_5 \in \mathbb N$ all the 4 operations: $+ - \times /$ a specific brackets pattern: $\left(\left(\left(x_1 + x_2 \right) - x_3\right) \times x_4 \right) / ...
3
votes
2answers
143 views

Can this be solved by induction? (number of ways of cutting a rod into pieces)

I am reading an algorithm example. The example is about Rod cutting. The idea is that a steel rod can either be sold as it is, or be cut into integral pieces and ...
4
votes
2answers
257 views

Upper bound for the partial sum $\sum k \lg k$ via summation?

In this lecture of an introductory class to algorithms (video here, time 74:09), the professor cites the following as an upper bound: $$ \sum_{k=2}^n k \lg k \leq \frac{1}{2} n^2 \lg n - \frac{1}{8} ...
0
votes
2answers
239 views

Floor and ceiling on fractions

Is there an algorithm to compute ceil and floor on fractions without computing the division between the numerator and denominator (to avoid losing precision on big numbers)? A trivial example: ...
0
votes
1answer
100 views

Help on understanding the proof for the max subsequence problem

I am trying to understand a proof. The problem is the detection of the maximum continuous subsequence sum problem (i.e. find the subsequence of an array that gives the maximum sum). The ...
6
votes
4answers
504 views

calculating n choose k mod one million

I am working on a programming problem where I need to calculate 'n choose k'. I am using the relation formula $$ {n\choose k} = {n\choose k-1} \frac{n-k+1}{k} $$ so I don't have to calculate huge ...
0
votes
1answer
41 views

Formula to recalculate variables from real numbers range to non-negative range

I'm struggling with this for quite some time now. I'm trying to recalculate values uniformly distributed in real numbers range to numbers in non-negative range. Length of non-negative range can vary ...
4
votes
1answer
87 views

Proving that $n^n \notin O((n+1)!)$

How does one show that $n^n \notin O((n+1)!)$ without using limits? I've recently been trying to prove such results without limits, and this is one case that is still bothering me.
0
votes
1answer
108 views

Need an algebraic formula for this algorithmic problem

I'm not sure if there is a given term for this problem but I'm trying to find the number of iterations required to complete this type of pattern: Consider two patterns/lists: ...
2
votes
2answers
249 views

How to solve this basic math problem?

I'm having this problem on some game I'm coding which I think it's just math and has nothing to do with coding, that's why I'm posting it here and I'm going to simplify the problem without describing ...
4
votes
1answer
506 views

Algorithm for computing square root of a perfect square integer?

My question is the following: Is there a polytime non-numerical algorithm for computing square root of perfect square integers? The more elementary the algorithm is, the better! EDIT: ...
3
votes
0answers
108 views

Algorithm/Formula to compute adding and/or removing compound and/or non-compound percentages from a value?

I will first start with a scenario, I have to apply some adjustments to a particular value. These adjustments are either compound or non-compounded and they can either be added or subtracted to the ...
7
votes
2answers
350 views

Algorithm(s) for computing an elementary symmetric polynomial

I've run into an application where I need to compute a bunch of elementary symmetric polynomials. It is trivial to compute a sum or product of quantities, of course, so my concern is with computing ...