Message Boards Message Boards

0
|
5531 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Working with For loop results in Mathematica

Posted 9 years ago
POSTED BY: Erik Gentzel
3 Replies
POSTED BY: Vitaliy Kaurov
Posted 9 years ago

Is this something like what you need?

sequence = {6, 3, 2, 4, 1, 2, 3, 4, 5, 4, 3, 2, 1, 3}; Do[
 s = sequence[[a ;; b]]; 
 If[s == Reverse[s], Print[s]], {a, 1, Length[sequence] - 1}, {b, 
  a + 1, Length[sequence]}]


{1,2,3,4,5,4,3,2,1}

{2,3,4,5,4,3,2}

{3,4,5,4,3}

{4,5,4}
POSTED BY: Paul Cleary
POSTED BY: Erik Gentzel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract