Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you translate this for loop into mathematics

Tags:

math

I'm trying to solve what seems to be a simple math problem. I can write the problem as a for loop, but I'm not sure how to translate it into an equation. Can anyone help?

x = 10;
for(int i=0; i<3000; i++)
{
    x = x^2
}
like image 527
user113164 Avatar asked Aug 19 '09 02:08

user113164


People also ask

How do you translate a sentence into math?

Step 1: Assign a variable to the unknown quantity. Let the unknown number = z Step 2: Find two verbal expressions for the same value. *use fractions when converting the word “quotient” into a mathematical equation Step 4: Solve the equation.

What is the meaning of loop in maths?

The term "loop" has a number of meanings in mathematics. Most simply, a loop is a closed curve whose initial and final points coincide in a fixed point known as the basepoint. Formally, if is a topological space and , a loop is a continuous map.

What does this symbol mean ∑?

Simple sum The symbol Σ (sigma) is generally used to denote a sum of multiple terms. This symbol is generally accompanied by an index that varies to encompass all terms that must be considered in the sum. For example, the sum of first whole numbers can be represented in the following manner: 1 2 3 ⋯.

How do you write a loop in mathly?

Just write $C_{i,y,z}=a_{i,y,z}+b_{y,z}$ with $i=1,\ldots,10$.


2 Answers

x^(2^3000) where ^ means to the power of

like image 54
Marius Avatar answered Oct 15 '22 03:10

Marius


You provided code, and are asking us to provide the mathematical equivalent -- so I'm going to take your code literally, and assume it's a C-like language.

In that environment, ^ is the bitwise XOR operator. So after the loop x = 10, since it was XOR-ed with a constant 2 (toggling the next-to-LSB bit) an even number of times.

Or was this merely pseudocode -- did you really mean exponentiation?

like image 26
Jim Lewis Avatar answered Oct 15 '22 03:10

Jim Lewis