In article <425973C0.2080007 / mktec.com>, Zach Dennis <zdennis / mktec.com> wrote: >I have the following table of data, and I am looking to create an >equation to recreate the table. If anyone finds this sort of thing fun, >or has a online resource or a good book that helps explaining these >types of math concepts, please take a stab at it or post any info that >might aide me in my discovery! I've been trying the past several hours >and this sort of thing isn't my strong suit...and i'm stuck! > >I am first looking to understand how-to make the pattern of data into a >actual math equation...then from there I'd like to write ruby code for >the equation. > >Here is the sample data in a table: > - rows represent a different character (as labeled) > - columns represent the position of the character > (examples represent data in decimal notation, not octal/hex) > example: "aaaa" would become 000 003 002 005 > example: "zach" would become 027 003 000 012 > > 1 2 3 4 5 6 (etc......) >---------------------------------------------------- >a 1 |0 3 2 5 4 7 >b 2 |3 0 1 6 7 4 >c 3 |2 1 0 7 6 5 >d 4 |5 6 7 0 1 2 >e 5 |4 7 6 1 0 3 >f 6 |7 4 5 2 3 0 >g 7 |6 5 4 3 2 1 >h 8 |9 10 11 12 13 14 >i 9 |8 11 10 13 12 15 >j 10 |11 8 9 14 15 12 >k 11 |10 9 8 15 14 13 >l 12 |13 14 15 8 9 10 >m 13 |12 15 14 9 8 11 >n 14 |15 12 13 10 11 8 >o 15 |14 13 12 11 10 9 >p 16 |17 18 19 20 21 22 >q 17 |16 19 18 21 20 23 >r 18 |19 16 17 22 23 20 >s 19 |18 17 16 23 22 21 >t 20 |21 22 23 16 17 18 >u 21 |20 23 22 17 16 19 >v 22 |23 20 21 18 19 16 >w 23 |22 21 20 19 18 17 >x 24 |25 26 27 28 29 30 >y 25 |24 27 26 29 28 31 >z 26 |27 24 25 30 31 28 I think the table got a bit shifted so I shifted it back... What's the application for this or is it just a brain teaser? Just a few ideas: For character 'a' it looks like the 'formula' would be something like: if(position.odd?) return position - 1 else return position + 1 end (BTW: it also looks like the numbers in column 1 follow this same pattern) For character 'b' it's a bit stranger, recreating that row of the table: > 1 2 3 4 5 6 (7) (8) >---------------------------------------------------- >b 2 |3 0 1 6 7 4 5 10 (1+2) (2-2) (3-2) (4+2) (5+2) (6-2) (7-2) (8+2) I'm guessing the 7 and 8 columns will follow the same pattern. Also, I'd look into the idea that maybe these are modulo-n counters (?) However, if I look at the row numbers I can see that they directly map onto columns as well, look at row 'c' and column 3: 1 2 3 4 5 6 (etc......) ---------------------------------------------------- 2 1 c 3 |2 1 0 7 6 5 7 6 5 Phil