Message Boards Message Boards

GROUPS:

Colorize grid of numbers according to rules?

Posted 17 days ago
372 Views
|
12 Replies
|
0 Total Likes
|

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 ?

12 Replies

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 16 days 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 16 days 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 16 days 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 16 days ago

Giving me some kind of error

enter image description here

Posted 16 days ago

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

Posted 15 days ago

Ohh, newby what to say =))

Posted 15 days 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

9 x 9 = 81, but

Length[numbers]
(*   Out:  79    *)
Posted 14 days 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 14 days 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 14 days ago

Thank you very much Sir.

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