Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Let's list the base cases:
- for n=1 : a(1)=2
- sequences => 1,2
- for n=2 : a(2)=5 = 2 + 3^(2-1)
- sequences => 11,21
- 00,12,22
- for n=3 :a(3)=14=5+3^(3-1)
- sequences => 12 1,21 1,00 1,11
- 002,010,020,100,112,122,200,212,222
- so above sequence follows some rules that can be deduced based on my obsevations:-
- 1. rule for 1st line: use (n-1)-length valid sequences and just append 1 at end to each.
- 2. rule for 2nd line:write all possible (n-1)-length ternary sequences (i.e 3^(n-1)) and append 0 if no. of zeros is not even else append 2.
- However i came up with such observation after checking each of the options. If such a prob occured in any test i would not have thought of such clumsy obs. and just derived the base cases ,straightly checked each options for correctness.
Add Comment
Please, Sign In to add comment