Group Abstract Group Abstract

Message Boards Message Boards

0
|
465 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to deduce the preceding several terms of a sequence from its recurrence relation?

Posted 2 months ago

enter image description here

For the above problem, we can write the recurrence relation, but we know that the 7th term equals 2. How can we work backwards to derive all possible values of the sequence from the 1st term to the 7th term?

Now, under the premise that I know the answer, all the cases generated by the first term of each sequence in the answer are shown in the following code:

rel = a[n] == 
  Piecewise[{{3 a[n - 1] + 1, Mod[a[n - 1], 2] == 1}, {a[n - 1]/2, 
     Mod[a[n - 1], 2] == 0}}]
RecurrenceTable[{a[1] == #, rel}, a, {n, 7}] & /@ {128, 21, 20, 3}

enter image description here

POSTED BY: Bill Blair
Posted 2 months ago
  CollatzTree[val_, steps_] := 
     NestList[
      Flatten[# /. 
         n_Integer :> {2 n, 
           If[IntegerQ[(n - 1)/3] && 
             OddQ[(n - 1)/3] && (n - 1)/3 > 1, (n - 1)/3, 
            Nothing]}] &, {val}, steps]
    CollatzTree[16, 5] // Column
POSTED BY: Bill Blair
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard