Title description
Cut noodles
One high-gluten ramen noodles, cut in the middle, you can get 2 noodles.
If you fold it in half and cut it in the middle, you can get 3 noodles.
If you fold in half twice and cut in the middle, you can get 5 noodles.
So, how many noodles will you get if you fold in half 10 times and cut in the middle?
The answer is a whole number, please submit the answer through the browser. Don't fill in any redundant content.
Problem solving ideas
We can easily get a sequence of a(0)=2, a(1)=3, a(2)=5, a(3)=9, a(4)=17...The
first method
we can think of This is an analogue geometric sequence, which can be considered a(n)=2 n +1, and then a(10)=2 10 +1=1025
In the second method,
we can also find that a(1)=2a(0)-1, a(2)=2a(1)-1...to
sum up, a(n)=2a(n-1)-1
Reference Code
public class Test {
public static void main(String[] args) {
int count = 2;
int n=10;
for (int i = 1; i < n+1; i++) {
count=2*count-1;
}
System.out.println(count);
}
}
Answer: 1025