# How do I generate the first 12 numbers in the sequence 1, 1, 1, 2, 2, 3, 4, 5, 7, 9 using a while loop?

I have figured out the formula to work the sequence out which is the use the each number in the sequence uses the previous previous previous number + the previous previous number for example to get the number 4 you use the previous x3 number which is the first 2 in the sequence plus the previous x2 number which is the second 2 in the sequence. I understand that I have to use 4 variables and then swap the number accordingly in the loop but i cant quite figure out...

By: StackOverFlow - Friday, 9 November

# Related Posts

- Older News
- Why does my list include numbers bigger than the while loop? StackOverFlow (Yesterday) - I created a while loop with break statements inside it to print some numbers and avoid others and it ended up printing a number bigger the the limit of my...
- How can user input a sequence of numbers into array// Java StackOverFlow (Yesterday) - so i've been trying to do this one thing which is letting user input his sequence number into array. I mean f.e. if he wanted to input 9901229976 and 9...
- Want to use an array created in a method, for further use in another method StackOverFlow (2 days ago) - I have a problem and the title actually sums it up perfectly. So i'll just go ahead and show you the code snippet.So the methode generate, is generating an array,...
- Java-calculating the sum of last two numbers in a line of x numbers StackOverFlow (3 days ago) - The input is a x number of numbers separated by spaces. It has to take the last 2 numbers and calculate their sum. I can only use scanner, int, boolean,...
- Checking if sequence is almost strictly in ascending order StackOverFlow (3 days ago) - This was part of my interview questions.Given a sequence of integers as an array, I have to determine whether it is possible to obtain a strictly increasing sequence by removing...