For a homework assignment in my intro to java class I was given the following problem:

Write for, do-while, and while statements to compute the following sum and product

1. 1 + 7 + 25 + 79 + .... + (3^20 - 2)

2. 1 x 3 x 9 x 27 x 81 x ... x (3^20)

I understand how to write the statements, I'm just not sure how to express the increment.

For the first one (for statement) I have

```
int i, sum = 0;
for (i = 1; i =< 2486784399; // I'm not sure what would go here ) {
sum += i;
]
System.out.println(“The sum is” + sum);
```

I'm not sure how to show that it's increasing by 3^(n) - 2