Message Boards Message Boards

0
|
3190 Views
|
15 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to put sequence in a 3 column row?

Posted 2 years ago

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 ?

POSTED BY: Sergey Scorin
15 Replies
Posted 2 years ago

I mean how to crash this numbers to one and color them accordingly ?

POSTED BY: Sergey Scorin
Posted 2 years ago

What "same process"?

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Could you please eplain me how to do the same process but only with grid of numbers like this :

23 18 25

24 22 20

19 26 21

POSTED BY: Sergey Scorin
Posted 2 years ago

Oh, thanks.

POSTED BY: Sergey Scorin

Your curly braces do not match.

POSTED BY: Gianluca Gorni
Posted 2 years 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 ?

POSTED BY: Sergey Scorin

You are giving both green and blue to 2,5,8, and the earliest that applies is used. Give Blue to 3-6-9.

POSTED BY: Gianluca Gorni
Posted 2 years 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.

POSTED BY: Sergey Scorin

@Sergey Scorin please make sure you know the rules: https://wolfr.am/READ-1ST

The 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.

enter image description here

POSTED BY: Moderation Team

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
POSTED BY: Gianluca Gorni
Posted 2 years 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 ...

POSTED BY: Sergey Scorin
Posted 2 years 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.

POSTED BY: Rohit Namjoshi

... 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
POSTED BY: Henrik Schachner
Posted 2 years 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?

POSTED BY: Sergey Scorin

Maybe like this:

data = FixedPoint[IntegerDigits /* Total, #] & /@ 
  Table[Fibonacci[n], {n, 32}]
Partition[data, 3] // TableForm
POSTED BY: Gianluca Gorni
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