Efficient Algorithm for Calculating (n^x)/d

  • Thread starter Atran
  • Start date
In summary, the conversation discusses an algorithm for solving a given equation involving an integer, exponent, and divisor. The algorithm involves setting the equation and using a specific formula to solve for the desired result. The speaker also suggests a different approach to writing the equation in order to potentially receive more feedback on its efficiency.
  • #1
Atran
93
1
Hi, I've recently found the following algorithm and I'm willing to share it:

For example, given an integer n=46, an exponent x=5, and d=13, we have 465/13.
First, we set the equation, n = q*d + r = q*13 + r
We have, 46 = 3*13 + 7
Thus, [q=3, r=7, d=13]
And: 465/13 = 3*464 + 7*(3*463 + 7*(3*462 + 7*(3*461 + 7*(46/13))))

Let [q, r, d] and we have (n^4)/d, then:
(n^4)/d = q*n^(4-1) + r*(q*n^(4-2) + r*(q*n^(4-3) + r*(n/d)))

I don't know if it's interesting to you or not, but what are your thoughts about it?
 
Mathematics news on Phys.org
  • #2
Perhaps you'll get more comments if you write the expression in a less computationally efficient manner.

[itex] \frac{(qd + r)^5}{d} = q(qd+r)^4 + rq(qd+r)^3 + r^2q(qd+r)^2 + r^3q(qd+r) + r^4\frac{(qd+r)}{d} [/itex]
 

1. What is the formula for calculating (n^x)/d?

The formula for calculating (n^x)/d is (n^x)/d = n^(x-1)/d.

2. How is (n^x)/d different from (n/d)^x?

The main difference between (n^x)/d and (n/d)^x is the order of operations. In (n^x)/d, the exponent is applied first and then divided by d. In (n/d)^x, the division is applied first and then raised to the power of x.

3. Can (n^x)/d be simplified further?

Yes, (n^x)/d can be simplified further if both n and d have a common factor. In that case, the common factor can be factored out and the simplified formula would be (n/d)^x.

4. What happens if x is a negative number in (n^x)/d?

If x is a negative number in (n^x)/d, then the formula would be (n^x)/d = (1/n)^|x| * d. The absolute value of x is taken because a negative exponent indicates the reciprocal of the base raised to the positive power.

5. Are there any restrictions on the values of n, x, and d in (n^x)/d?

Yes, there are some restrictions on the values of n, x, and d in (n^x)/d. n and d cannot be equal to 0, and x must be a real number. Additionally, if d is a negative number, x must be an integer to ensure a real result.

Similar threads

  • General Math
Replies
2
Views
1K
Replies
4
Views
931
  • Precalculus Mathematics Homework Help
Replies
6
Views
1K
Replies
3
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
12
Views
971
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
Replies
2
Views
1K
  • Precalculus Mathematics Homework Help
Replies
27
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
560
  • General Math
Replies
2
Views
995
Back
Top