- #1

- 8

- 0

while(n < k)

n = n*a

How do I represent this with mathematical notation (e.g with summation)?

- Thread starter moni94
- Start date

- #1

- 8

- 0

while(n < k)

n = n*a

How do I represent this with mathematical notation (e.g with summation)?

- #2

Stephen Tashi

Science Advisor

- 7,389

- 1,367

That's not good code. It didn't initialize n.

Maybe it was intended to compute [tex] a^{k-1} [/tex]

Maybe it was intended to compute [tex] a^{k-1} [/tex]

- #3

- 5

- 0

n is arbitrary. We're not writing a program here, I was just using pseudocode to demonstrate the concept.

Oh, and the code is supposed to be:

while(n < k)

n = n + n*a

Oh, and the code is supposed to be:

while(n < k)

n = n + n*a

Last edited:

- #4

Stephen Tashi

Science Advisor

- 7,389

- 1,367

Well, if the arbitrary n starts out greater than the arbitrary k, that would be a simple concept.n is arbitrary. We're not writing a program here, I was just using pseudocode to demonstrate the concept.

- #5

- 5

- 0

Ok n < k.

- #6

I like Serena

Homework Helper

- 6,577

- 176

Let N be the first number n

Or:

[tex]\left\lfloor \frac k {n_0 \ln(1 + a)} \right\rfloor[/tex]

- #7

- 8

- 0

Thanks, that's what I needed!_{i}} be the sequence given by n_{i+1}=n_{i}+ n_{i}* a.

Let N be the first number n_{i}such that n_{i-1}≤ k and n_{i}> k.

Or:

[tex]\left\lfloor \frac k {n_0 \ln(1 + a)} \right\rfloor[/tex]

- #8

I like Serena

Homework Helper

- 6,577

- 176

Just out of curiosity - what did you need it for?Thanks, that's what I needed!

- #9

- 8

- 0

- #10

I like Serena

Homework Helper

- 6,577

- 176

Ah, so you mostly needed the final formula?

Please note, that this is the total price of the buildings which is one more than you can buy .

- Last Post

- Replies
- 6

- Views
- 889

- Last Post

- Replies
- 3

- Views
- 2K

- Last Post

- Replies
- 4

- Views
- 1K

- Last Post

- Replies
- 2

- Views
- 1K

- Last Post

- Replies
- 7

- Views
- 975

- Replies
- 1

- Views
- 2K

- Last Post

- Replies
- 6

- Views
- 2K

- Last Post

- Replies
- 2

- Views
- 2K

- Replies
- 5

- Views
- 2K

- Replies
- 2

- Views
- 2K