Message Boards Message Boards

0
|
3363 Views
|
12 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Colorize grid of numbers according to rules?

Posted 2 years ago

Hello everyone. I have an issue with my formula that is crashing list of numbers into one digit and than colorize it in different colors :

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, 4] // TableForm

it is working great!

but now i need to do the same process with a grid of defined numbers ( not fibonacci sequence )

like this one :

1635,3270,6541,13082,26163,52326,104652,209304,418608, 1732,3465,6930,13859,27718,55436,110872,221744,443488, 1835,3671,7342 14683,29366,58732,117464,234928,469856, 1945,3889,7778,15557,31113,62226,124452,248904,497808, 2060,4120,8241,16482,32963,65926,131852,263704,527408, 2183,4365,8731,17462,34923,69846,139692,279384,558768, 2312,4625,9250,18500,36999,73998,147996,295992,591984, 2450,4900,9800,19600,39200,78400,156800,313600,627200, 2596,5191,10383,20765,41530,83060,166120,332240,664480, 2750,5500,11000,22000,44000,88000,176000,352000,704000, 2914,5827,11654,23308,46616,93232,186464,372928,745856, 3087,6174,12347,24694,49388,98776,197552,395104,790208,

could you please correct the formula where i can insert a grig of numbers and it will crash numbers to one ditit and colorize it based on values in a formula ?

POSTED BY: Sergey Scorin
12 Replies

9 x 9 = 81, but

Length[numbers]
(*   Out:  79    *)
POSTED BY: Henrik Schachner
Posted 2 years ago

A few little commas were missing between numbers. Could you please tell me how to make the same process with same colorizing but without digital rooting, crashing to one number ?

POSTED BY: Sergey Scorin
Posted 2 years ago
numbers = {37, 78, 29, 70, 21, 62, 13, 54, 5, 6, 38, 79, 30, 71, 22, 
   63, 14, 46, 47, 7, 39, 80, 31, 72, 23, 55, 15, 16, 48, 8, 40, 81, 
   32, 64, 24, 56, 57, 17, 49, 9, 41, 73, 33, 65, 25, 26, 58, 18, 50, 
   1, 42, 74, 34, 66, 67, 27, 59, 10, 51, 2, 43, 75, 35, 36, 68, 19, 
   60, 11, 52, 3, 44, 76, 77, 28, 69, 20, 61, 12, 53, 4, 45};

colored = 
  numbers /. {r_ /; Mod[r, 3] == 1 :> Style[r, Red, 24], 
    g_ /; Mod[g, 3] == 2 :> Style[g, Green, 24], 
    b_ /; Mod[b, 3] == 0 :> Style[b, Blue, 24]};

colored // Partition[#, UpTo[9]] & // Grid[#, Frame -> All, Spacings -> {1, 1}] &
POSTED BY: Hans Milton
Posted 2 years ago

Thank you very much Sir.

POSTED BY: Sergey Scorin
Posted 2 years ago
numbers = {1635, 3270, 6541, 13082, 26163, 52326, 104652, 209304, 
   418608, 1732, 3465, 6930, 13859, 27718, 55436, 110872, 221744, 
   443488, 1835, 3671, 7342, 14683, 29366, 58732, 117464, 234928, 
   469856, 1945, 3889, 7778, 15557, 31113, 62226, 124452, 248904, 
   497808, 2060, 4120, 8241, 16482, 32963, 65926, 131852, 263704, 
   527408, 2183, 4365, 8731, 17462, 34923, 69846, 139692, 279384, 
   558768, 2312, 4625, 9250, 18500, 36999, 73998, 147996, 295992, 
   591984, 2450, 4900, 9800, 19600, 39200, 78400, 156800, 313600, 
   627200, 2596, 5191, 10383, 20765, 41530, 83060, 166120, 332240, 
   664480, 2750, 5500, 11000, 22000, 44000, 88000, 176000, 352000, 
   704000, 2914, 5827, 11654, 23308, 46616, 93232, 186464, 372928, 
   745856, 3087, 6174, 12347, 24694, 49388, 98776, 197552, 395104, 
   790208};

digitalRoots = Mod[#, 9, 1] & /@ numbers;
colored = digitalRoots /. 
  {r : (1 | 4 | 7) :> Style[r, Red, 24], 
   g : (2 | 5 | 8) :> Style[g, Green, 24], 
   b : (3 | 6 | 9) :> Style[b, Blue, 24]};

colored // Partition[#, UpTo[9]] & // Grid[#, Frame -> All, Spacings -> {1, 1}] &

enter image description here

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Giving me some kind of error

enter image description here

POSTED BY: Sergey Scorin
Posted 2 years ago

That is because you did not evaluate (Shift + Enter) the assignment: numbers={1635,3270, ... }

POSTED BY: Hans Milton
Posted 2 years ago

Ohh, newby what to say =))

POSTED BY: Sergey Scorin
Posted 2 years ago

Hello again. I am trying to insert new set of numbers 37, 78, 29, 70, 21, 62, 13, 54, 5 6 , 38, 79, 30, 71, 22, 63 , 14, 46, 47, 7, 39, 80, 31, 72, 23, 55 , 15, 16, 48, 8, 40, 81, 32, 64, 24 , 56 57 , 17, 49 , 9 , 41 , 73, 33 , 65, 25, 26 , 58 , 18 , 50 , 1 , 42, 74, 34, 66, 67 , 27 , 59 , 10 , 51 , 2 , 43 , 75 , 35, 36, 68 , 19 , 60, 11, 52, 3 , 44, 76, 77 , 28 , 69 , 20 , 61 , 12 , 53 , 4 , 45

in to 9x9 grid and somehow 2 nubers is missing couldy you please point me out where to fix the formula or what i am doing wrong?

enter image description here

POSTED BY: Sergey Scorin

I don't know what you are trying to achieve, but it may have something to do with this:

{1635, 3270, 6541, 13082, 26163, 52326} /.
 n_Integer :> Style[Last@IntegerDigits[n], Hue[n/10]]
POSTED BY: Gianluca Gorni
Posted 2 years ago

Gianluca,

It seems Sergey is using the word "crash" to mean digital root.

numbers = {1635, 3270, 6541, 13082, 26163, 52326};
digitalRoots = Mod[#, 9, 1] & /@ numbers
digitalRoots /. {r : (1 | 4 | 7) :> Style[r, Red], 
  g : (2 | 5 | 8) :> Style[g, Green], 
  b : (3 | 6 | 9) :> Style[b, Blue]}
POSTED BY: Rohit Namjoshi
Posted 2 years ago

Yes, this what I want. Could you please make a formula that is 9 by 12 rows

to put this set of numbers

1635,3270,6541,13082,26163,52326,104652,209304,418608, 1732,3465,6930,13859,27718,55436,110872,221744,443488, 1835,3671,7342,14683,29366,58732,117464,234928,469856, 1945,3889,7778,15557,31113,62226,124452,248904,497808, 2060,4120,8241,16482,32963,65926,131852,263704,527408, 2183,4365,8731,17462,34923,69846,139692,279384,558768, 2312,4625,9250,18500,36999,73998,147996,295992,591984, 2450,4900,9800,19600,39200,78400,156800,313600,627200, 2596,5191,10383,20765,41530,83060,166120,332240,664480, 2750,5500,11000,22000,44000,88000,176000,352000,704000, 2914,5827,11654,23308,46616,93232,186464,372928,745856, 3087,6174,12347,24694,49388,98776,197552,395104,790208,

POSTED BY: Sergey Scorin
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