Guest User

Untitled

a guest
Jan 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. Let's list the base cases:
  2. for n=1 : a(1)=2
  3. sequences => 1,2
  4. for n=2 : a(2)=5 = 2 + 3^(2-1)
  5. sequences => 11,21
  6. 00,12,22
  7. for n=3 :a(3)=14=5+3^(3-1)
  8. sequences => 12 1,21 1,00 1,11
  9. 002,010,020,100,112,122,200,212,222
  10.  
  11. so above sequence follows some rules that can be deduced based on my obsevations:-
  12.  
  13. 1. rule for 1st line: use (n-1)-length valid sequences and just append 1 at end to each.
  14.  
  15. 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.
  16.  
  17. 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