Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. f[Range[8]]
  2. Flatten[Table[f[%[[p]]], {p, Length[%]}], 1]
  3. Flatten[Table[f[%[[p]]], {p, Length[%]}], 1]
  4.  
  5. {{1, 2, {3, 4}, 5, 6, 7, 8},
  6. {1, 2, 3, {4, 5}, 6, 7, 8},
  7. {1, 2, 3, 4, {5, 6}, 7, 8}}
  8.  
  9. {{1, 2, {{3, 4}, 5}, 6, 7, 8},
  10. {1, 2, {3, 4}, {5, 6}, 7, 8},
  11. {1, 2, {3, {4, 5}}, 6, 7, 8},
  12. {1, 2, 3, {{4, 5}, 6}, 7, 8},
  13. {1, 2, {3, 4}, {5, 6}, 7, 8},
  14. {1, 2, 3, {4, {5, 6}}, 7, 8}}
  15.  
  16. {{1, 2, {{{3, 4}, 5}, 6}, 7, 8},
  17. {1, 2, {{3, 4}, {5, 6}}, 7, 8},
  18. {1, 2, {{3, {4, 5}}, 6}, 7, 8},
  19. {1, 2, {3, {{4, 5}, 6}}, 7, 8},
  20. {1, 2, {{3, 4}, {5, 6}}, 7, 8},
  21. {1, 2, {3, {4, {5, 6}}}, 7, 8}}
  22.  
  23. NestWhileList[
  24. Flatten[Table[f[# &[[p]]], {p, Length[# &]}], 1],
  25. f[Range[8]], Length[#] & < 3!]
  26.  
  27. {{{1, 2, {3, 4}, 5, 6, 7, 8},
  28. {1, 2, 3, {4, 5}, 6, 7, 8},
  29. {1, 2, 3, 4, {5, 6}, 7, 8}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement