# How to put sequence in a 3 column row?

Posted 1 month ago
445 Views
|
15 Replies
|
1 Total Likes
|
 Hi everyone. I have a sequence of numbers, let's say : data = FixedPoint[IntegerDigits /* Total, #] & /@ Table[Fibonacci[n], {n, 32}] (*{1,1,2,3,5,8,4,3,7,1,8,9,8,8,7,6,4,1,5,6,2,8,1,9,1,1,2,3,5,8,4,3}*) and I want to put them in a 3 column raw ( or may be 4,5 ).How can I do so ?
Answer
15 Replies
Sort By:
Posted 1 month ago
 Maybe like this: data = FixedPoint[IntegerDigits /* Total, #] & /@ Table[Fibonacci[n], {n, 32}] Partition[data, 3] // TableForm 
Answer
Posted 1 month ago
 Oh, yeah! Cool. May be do you know how to color this numbers based on it valu 1-4-7 - in red, 2-5-8 in green and 3-6-9 in blue?
Answer
Posted 1 month ago
 May be do you know how to color this numbers based on it valu 1-4-7 - in red, 2-5-8 in green and 3-6-9 in blue ? Did you fix the syntax errors in your previous attempt to do this? If so, please post the code.
Answer
Posted 1 month ago
 Nope! I said you it is not easy to me to open the Mathematica and write something there and you suggest me to correct mistakes in something I am afraid of ! ! ! data = FixedPoint[IntegerDigits /* Total, #] & /@ Table[Fibonacci[n], {n, 32}] (*{1,1,2,3,5,8,4,3,7,1,8,9,8,8,7,6,4,1,5,6,2,8,1,9,1,1,2,3,5,8,4,3}*) Which[MemberQ[{1, 4, 7}[#, Red], # <= MemberQ[{2, 5, 8}[#, Green], # <= MemberQ[{3, 6, 9}[#, Blue]] & /@ data I see red and green errors that Mathematica tells me to fix, but I don't know what to replace it with ...
Answer
Posted 1 month ago
 ... and I want to put them in a 3 column raw ( or may be 4,5 ) Sergey, you should rather put them in a 24-column table (I find this surprising!): data = FixedPoint[IntegerDigits /* Total, #] & /@ Table[Fibonacci[n], {n, 240}]; Partition[data, Length[FindRepeat[data]]] // TableForm 
Answer
Posted 1 month ago
 You can use pattern replacement to color the numbers: data = FixedPoint[IntegerDigits /* Total, #] & /@ Table[Fibonacci[n], {n, 32}] /. {r : (1 | 4 | 7) :> Style[r, Red], g : (2 | 5 | 8) :> Style[g, Green]} Partition[data, 3] // TableForm 
Answer
Posted 1 month ago
 Thank you. It is working for me. But why when i am trying to add blue color the same way {r : (1 | 4 | 7) :> Style[r, Red], g : (2 | 5 | 8) :> Style[g, Green]}, b : (2 | 5 | 8) :> Style[b, Blue]} - it is not working! Could you please correct me.
Answer
Posted 1 month ago
 You are giving both green and blue to 2,5,8, and the earliest that applies is used. Give Blue to 3-6-9.
Answer
Posted 1 month ago
 Still no luck data = FixedPoint[IntegerDigits /* Total, #] & /@ Table[Fibonacci[n], {n, 99}] /. {r : (1 | 4 | 7) :> Style[r, Red], g : (2 | 5 | 8) :> Style[g, Green]}, b : (3 | 6 | 9) :> Style[b, Blue]} Partition[data, 3] // TableForm what's wrong ?
Answer
Posted 1 month ago
 Your curly braces do not match.
Answer
Posted 1 month ago
 Oh, thanks.
Answer
Posted 1 month ago
 Could you please eplain me how to do the same process but only with grid of numbers like this :23 18 2524 22 2019 26 21
Answer
Posted 1 month ago
 What "same process"?
Answer
Posted 1 month ago
 I mean how to crash this numbers to one and color them accordingly ?
Answer
Posted 1 month ago
 @Sergey Scorin please make sure you know the rules: https://wolfr.am/READ-1STThe rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this. int = Integrate[1/(x^3 - 1), x]; Map[Framed, int, Infinity] You can also embed notebook or attach notebook.
Answer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments