# Java shortening Help

#### Ten_Tacles

##### Level 42
for(int i=0; i < Level; i++) {

Blockamount = Blockamount + ((((Level*2)-(i*2+1))*((Level*2)-(i*2+1)))*(i+1));

}

Basically, I want to shorten this function into a formula.

I just don't know how.

It is also very complicated >.<

#### The Noodle

##### Level 48
Eep. Why not a language like python?

#### Ten_Tacles

##### Level 42
Because I am learning Java in school.

And I can't be bothered to read a tutorial :E

#### The Noodle

##### Level 48
((((1*2)-(i*2+1))*((1*2)-(i*2+1)))*(i+1)) + ((((2*2)-(i*2+1))*((2*2)-(i*2+1)))*(i+1)) ... ((((n*2)-(i*2+1))*((n*2)-(i*2+1)))*(i+1))

#### Ten_Tacles

##### Level 42
O_O

Uh, would it be possible to take those ... thingy away?

Could I have it in a "...=..." form?

#### The Noodle

##### Level 48
Not really, what your asking for is more of a sequence than a single formula.

#### The Noodle

##### Level 48
Not really, what your asking for is more of a sequence than a single formula.

#### The Noodle

##### Level 48
Just realised I made a mistake, replace the i's with the n sequence, not the level #### Ten_Tacles

##### Level 42
Just realised I made a mistake, replace the i's with the n sequence, not the level ?

#### The Noodle

##### Level 48
Code:
`` ((((Level*2)-(i*2+1))*((Level*2)-(i*2+1)))*(i+1))``

As it is the i variable that increases it should be n and not the power level which is over 9000 (a constant).

#### Ten_Tacles

##### Level 42
What?

Is that a joke?

Or am I just stupid.

#### Woody2371

##### Level 47
I don't even...Noodle you trolling bro?

#### Woody2371

##### Level 47
But he's right, it's a sequence not a formula, as far as programming goes that's basically as short as it gets

#### Ten_Tacles

##### Level 42
But I need it as a forumula, to calculate it the other way around, take blockamount give level.

#### Woody2371

##### Level 47
I'll have a look at it when I haven't just woken up

#### Woody2371

##### Level 47
Wait why do you want to take the blockamount and give level? That just sounds...counter-intuitive #### Ten_Tacles

##### Level 42
Eh.

I have for each possible Spire four values.

Level, Height, Base size and Block amount.

I can calculate all missing values from Level Height (nearest Level) and Basesize, but Block amount is missing.

#### Ten_Tacles

##### Level 42
Is it actually possible to solve this? #### The Noodle

##### Level 48
Its easily mathematically solvable, its just not an equation.