additive sequence. 3,3,6,9,15.... is called an additive sequence where the first two numbers must be the same..3+3=6,3+6=9 and so on. Also a number can be split into one of more digits to from the additive sequence. For eg: 12,122,436... In that sequence,12+12=24....12+24=36. The question is given the starting and ending numbers,find all the possible terms in the additive sequence. I get it that one sequence can be found pretty easily.But I have no clue how to take the bigger numbers like 122,436 etc into consideration.
-
What exactly are you trying to do? there has to be a set logic for the sequence. are you taking 2 digits at a time, or 2 numbers for the sequence? Are you trying to program this? If so, in which language? – Jan S Oct 27 '11 at 05:15
-
I saw this question some on the internet.I tried programming it but I do not understand how to get all the possible sequences.Is it possible at all?Does my question make sense? – icedek Dec 07 '11 at 06:18
-
It should be `12,12,24,36`. Not `122,436` – Vbp Nov 11 '13 at 04:36
-
@Vaibhav No it shouldn't be - "a number can be split". – Bernhard Barker Nov 12 '13 at 11:24
1 Answers
For the sake of simplicity I'll say that an additive sequence is strict if no numbers are split. Strict additive sequences have the following form: n*1, n*1, n*2, n*3, n*5, ..., n*Fk, where Fk is the k-th Fibonacci number. Hence, for strict sequences you need to divide the last element by the first one and check whether the result is a Fibonacci number. If yes, the sequence can be easily reconstructed. If no, no such sequence exists.
Let us now consider non-strict additive sequences and let A1...An be the first number. First of all, we try to find a strict additive sequence as explained above. If this attempt fails and an additive sequence exists, either A1...An or the last number should represent MORE then one "actual" number.
If A1...An represents more than one "actual" number, then there exists k <= n such that A_1+p = A_k+p for all 0 <= p <= min(n-k,k) (since the second number should be equal to the first one). If no such k can be found, there is no additive sequence. If such k can be found, try all numbers of the form A1...A_k-1 * F(m), where F(m) is the m'th Fibonacci number as long as this product is less or equal than the last number, and try to fit the sequence. If there is more than one such k (111) try all possibilities.
If the last number represents multiple numbers and A1...An does not, try all numbers of the form A1...A_n * F(m) in the same way as above.

- 3,567
- 2
- 16
- 32
-
+1 for multiples of the Fibonacci sequence. Can you elaborate on "if no numbers are split"? I'm having trouble thinking of an example where the Fibonacci sequence would not be present. The original problem states that the first two numbers must be the same, so wouldn't they all be "strict" sequences? – Derek May 08 '15 at 02:38
-
@Derek, quoting the original question "Also a number can be split into one of more digits to from the additive sequence. For eg: 12,122,436... In that sequence,12+12=24....12+24=36." A1...An are digits. – Alexander Serebrenik May 08 '15 at 06:27
-
Thanks. I look at 12,122,436 and see 12 * ( 1, 1, 2, 3 ), so the Fibonacci sequence still applies. – Derek May 08 '15 at 13:52
-
@Derek, sure the Fibonacci sequence still applies, the question is where to put commas I guess – Alexander Serebrenik May 08 '15 at 17:37