This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A147995 #46 Jun 05 2021 11:37:47 %S A147995 0,1,3,6,2,14,5,7,13,15,26,4,8,12,58,27,25,9,11,59,57,22,24,30,10,54, %T A147995 56,62,21,23,29,31,53,55,61,63,106,20,18,28,32,52,50,60,234,107,105, %U A147995 19,17,33,35,51,49,235,233,108,104,100,16,38,34,46,48,236,232,228,111 %N A147995 Array of N X N grid hopping "almost-walk", read by antidiagonals. %C A147995 The original name was: "The sequence is an anti-diagonal of the decimal of a mapped 4-ary Gray code matrix as a triangular sequence." %C A147995 _Gary W. Adamson_'s explanation of the sequence: Here's the conversion rules for the codons, 4-Ary gray code, which "turns out" to be the most appropriate format for mapping the Codons on a gray code Karnaugh map. The "why" this is the appropriate format relates to a degree of trial and error to find the proper fit in terms of the numbers of hydrogen bonds per codon- anticodon. (_Antti Karttunen_'s comment: obscure definition. The "degree of trial and error" should be defined transparently.) %C A147995 1) The "H-bond codon-anticodon magic square" map by Gary Adamson, published on page 287 of Cliff Pickover's book "Zen of Magic Squares..." looks like this: %C A147995 CCC CCU CUU CUC UUC UUU UCU UCC %C A147995 CCA CCG CUG CUA UUA UUG UCG UCA %C A147995 CAA CAG CGG CGA UGA UGG UAG UAA %C A147995 CAC CAU CGU CGC UGC UGU UAU UAC %C A147995 AAC AAU AGU AGC GGC GGU GAU GAC %C A147995 AAA AAG AGG AGA GGA GGG GAG GAA %C A147995 ACA ACG AUG AUA GUA GUG GCG GCA %C A147995 ACC ACU AUU AUC GUC GUU GCU GCC %C A147995 2) Using the conversion rules: 0 = C, 1 = A, 2 = G, 3 = U, we convert to 4-ary gray code: %C A147995 000 003 033 030 330 333 303 300 %C A147995 001 002 032 031 331 332 302 301 %C A147995 011 012 022 021 321 322 312 311 %C A147995 010 013 023 020 320 323 313 310 %C A147995 110 113 123 120 220 223 213 210 %C A147995 111 112 122 121 221 222 212 211 %C A147995 101 102 132 131 231 232 202 201 %C A147995 100 103 133 130 230 233 203 200 %C A147995 3) To convert back to decimal: %C A147995 0 3 14 15 58 57 62 63 %C A147995 1 2 13 12 59 56 61 60 %C A147995 6 7 8 11 54 55 50 49 %C A147995 5 4 9 10 53 52 51 48 %C A147995 26 25 30 31 32 35 46 47 %C A147995 27 24 29 28 33 34 45 44 %C A147995 22 23 18 17 38 39 40 43 %C A147995 21 20 19 16 37 36 41 42 %C A147995 ... and that's it! Notice how the 1,2,3,... jumps around, somewhat like a Peano curve, from one 4-unit cell to the next. %C A147995 _Antti Karttunen_'s notes: The steps 1 & 2 are clear, but the step 3 would not produce the array given here, but instead the array A163239. Furthermore, in Pickover's book the conversion rules C=0, A=1, U=2, G=3 are used, in which case we get the array A163235. Also, the path taken by the terms does not form a continuous Peano curve (Hamiltonian path), because there are discontinuities, e.g., when going from 3 to 4, or from 15 to 16. See A163357/A163359 & A163334/A163336 for examples of continuous Peano/Hilbert curves/paths in an N X N grid. However, this sequence is uniquely defined by the formula a(n) = A163485(A057300(A054238(n))). The 8 X 8 array given at the step 3 is the top left corner of the infinite square array whose antidiagonal gives this sequence. %C A147995 From _Gary W. Adamson_, Aug 04 2009: (Start) %C A147995 This entry was originally only an e mail to the coauthor; but given that the terms are correct, the complete set of rules for the system can be presented. %C A147995 Using 3 bit terms, we write out the Gray code for (0 - 7) as row headings; doing the same as the left column, then each of the 64 entries places the left column term (of 3 bits) underneath the top row headings. Then reading 2 bits from top to down in each entry, we use (0,0) = C; (1,1) = G; (0,1) = A and (1,0) = U. This gives the Gray code Karnaugh map along with 64 codons: %C A147995 . %C A147995 000...001...011...010...110...111...101...100 %C A147995 000...000...000...000...000...000...000...000 %C A147995 CCC...CCU...CUU...CUC...UUC...UUU...UCU...UCC %C A147995 000...001...011...010...110...111...101...100 %C A147995 001...001...001...001...001...001...001...001 %C A147995 CCA...CCG...CUG...CUA...UUA...UUG...UCG...UCA %C A147995 000...001...011...010...110...111...101...100 %C A147995 011...011...011...011...011...011...011...011 %C A147995 CAA...CAG...CGG...CGA...UGA...UGG...UAG...UAA %C A147995 000...001...011...010...110...111...101...100 %C A147995 010...010...010...010...010...010...010...010 %C A147995 CAC...CAU...CGU...CGC...UGC...UGU...UAU...UAC %C A147995 000...001...011...010...110...111...101...100 %C A147995 110...110...110...110...110...110...110...110 %C A147995 AAC...AAU...AGU...AGC...GGC...GGU...GAU...GAC %C A147995 000...001...011...010...110...111...101...100 %C A147995 111...111...111...111...111...111...111...111 %C A147995 AAA...AAG...AGG...AGA...GGA...GGG...GAG...GAA %C A147995 000...001...011...010...110...111...101...100 %C A147995 101...101...101...101...101...101...101...101 %C A147995 ACA...ACG...AUG...AUA...GUA...GUG...GCG...GCA %C A147995 000...001...011...010...110...111...101...100 %C A147995 100...100...100...100...100...100...100...100 %C A147995 ACC...ACU...AUU...AUC...GUC...GUU...GCU...GCC %C A147995 . %C A147995 Next, reading again from top 3 bits to bottom, we convert the base-2 Gray code to 4-ary Gray code using the rules (0,0) = 0; (0,1) = 1; (1,1) = 2; and (1,0) = 3; giving the array given using numbers (0,1,2, and 3) = 4-ary Gray code. The previous 2 maps have the unique Gray code property of having only a 1 bit (or 1 letter) change in any direction: up, down, right, left, including wrap-arounds. %C A147995 Last part of this system, we need create a linear system of Codons with only 1 bit (letter) change from one term to the next, giving an ordered decimal term for each Codon. This is done by converting the array with the (0,1,2,3) terms to the corresponding decimal term. Thus given the array: 000...003...033...030...330...333...etc; considered as 4-ary Gray code, these terms are equivalent to the array A147995 (then take antidiagonals). %C A147995 Following the numbers in succession in the array (0 -> 1 -> 2 ->...63) allows for us to have a linear system of Codons with only a 1-letter change from one Codon to the next, as follows: CCC -> CCA -> CCG -> CAU...-> through 63 = UCC. The other entries as of this date in the OEIS do not have the 1-letter (only) change from one associated decimal term to the next. For example, take entry A163235: If the decimal number system (given) is superimposed upon the 64 Codon array, the term 3 corresponds to CCG, but 4 in the left column corresponds to CAC, having a 2-letter change. Similarly, take A163239: If the decimal array in that entry is superimposed on the 64 Codon array, "3" corresponds in position to CCU, but "4" corresponds to CAC; again a 2-letter change. The system given in A147995 preserves the unique 1 (bit/letter) change from one Codon to any neighbor, going in any direction; along with the corresponding linear system with a 1-letter change from one Codon to the next. %C A147995 Last, we submit for each Codon the number of hydrogen bonds per codon/anti-codon using the following substitution rules: (C,G) = 3; (A,U) = 2, then add. %C A147995 This gives following array which we superimpose on the Codon array, giving the correct number of Hydrogen bonds for each Codon and anti-Codon: %C A147995 . %C A147995 9 8 7 8 7 6 7 8 %C A147995 8 9 8 7 6 7 8 7 %C A147995 7 8 9 8 7 8 7 6 %C A147995 8 7 8 9 8 7 6 7 %C A147995 7 6 7 8 9 8 7 8 %C A147995 6 7 8 7 8 9 8 7 %C A147995 6 8 7 6 7 8 9 8 %C A147995 8 7 6 7 8 7 8 9 %C A147995 ... (a semi-magic square with a binomial distribution of (1, 3, 3, 1) as to (6, 7, 8, 9) in every row and column. %C A147995 Example: CUG (3rd from left, row next to top) has (C=3, U=2, G=3), total 8. %C A147995 The anti-Codon of CUG = GAC and likewise has 8 hydrogen bonds. (End) %C A147995 From _Gary W. Adamson_, Aug 04 2009: (Start) %C A147995 The final outcome: superimposing the Codon map onto the decimal term map, we obtain a linear sequence of Codons with a 1-letter change between neighbors (which begs the question of how many such permutations are possible with the 1-letter change). The method of A147995 gives: %C A147995 . %C A147995 0 CCC; 16 AUC; 32 GGC; 48 UAC %C A147995 1 CCA; 17 AUA; 33 GGA; 49 UAA %C A147995 2 CCG; 18 AUG; 34 GGG; 50 UAG %C A147995 3 CCU; 19 AUU; 35 GGU; 51 UAU %C A147995 4 CAU; 20 ACU; 36 GUU; 52 UGU %C A147995 5 CAC; 21 ACC; 37 GUC; 53 UGC %C A147995 6 CAA; 22 ACA; 38 GUA; 54 UGA %C A147995 7 CAG; 23 ACG; 39 GUG; 55 UGG %C A147995 8 CGG; 24 AAG; 40 GCG; 56 UUG %C A147995 9 CGU; 25 AAU; 41 GCU; 57 UUU %C A147995 10 CGC; 26 AAC; 42 GCC; 58 UUC %C A147995 11 CGA; 27 AAA; 43 GCA; 59 UUA %C A147995 12 CUA; 28 AGA; 44 GAA; 60 UCA %C A147995 13 CUG; 29 AGG; 45 GAG; 61 UCG %C A147995 14 CUU; 30 AGU; 46 GAU; 62 UCU %C A147995 15 CUC; 31 AGC; 47 GAC; 63 UCC %C A147995 (End) %C A147995 From _Gary W. Adamson_, Aug 08 2009: (Start) %C A147995 The 8 X 8 array of hydrogen bonds can be derived from the 3rd row of A088696 (1, 2, 3, 2, 3, 4, 3, 2) using a simple conversion rule. Given the terms of A088696, each is replaced with its complement to 10: (1->9; 2->8; 3->7; 4->6) Note that the leftmost column going down should read: (9, 8, 7, 8, 7, 6, 7, 8) matching the top row from left to right. (End) %C A147995 From _Gary W. Adamson_, Aug 13 2009: (Start) %C A147995 Gray code -> <- Binary conversion rules: in either direction for any base; "N-Ary Gray code" -> "N-ary" or in the other direction. %C A147995 . %C A147995 First, N-Ary Gray code to N-Ary conversion. Write the N-Ary on a top row with the Gray code on the bottom row in both conversion variants. Given a Gray code on the bottom row, the N-Ary may be defined as "running sums MOD N" of the bottom row; then use the following rules: Leftmost term is the same. %C A147995 Next, use the sum of term (n-th) in the top row from the left, and the (n+1)-th term in the bottom row, MOD N. By way of example: %C A147995 Convert Gray code base 8, 3641063 to 8-ary. This gives initially, %C A147995 3.................. %C A147995 3..6..4..1..0..6..3 %C A147995 . %C A147995 Then (3 + 6) MOD 8 = 1 so we place a "1" above the 6 going to the right. %C A147995 Then (1 + 4) MOD 8 = 5 so we place a "5" above the 5. %C A147995 Continuing with this procedure, we obtain: %C A147995 3 1 5 6 6 4 7 8-Ary %C A147995 3 6 4 1 0 6 3 8-Ary Gray code %C A147995 . %C A147995 Using the 8 X 8 4-Ary chart, convert 133 (bottom row, 4th from the left) to 4-Ary then to decimal. Our setup is: %C A147995 1 %C A147995 1 3 3 %C A147995 getting (1, 0, 3). Then placing powers of 4 above the 4-Ary, = 1*16 + 3 = 19 as shown in the accompanying chart, 4-Ary Gray code 133 = 19 decimal. %C A147995 . %C A147995 Rules for converting an N-Ary number to the corresponding N-Ary Gray code: %C A147995 As before, we place the N-Ary on the top row with ongoing results on the bottom row = N-Ary Gray code. %C A147995 In the top row from left to right, through through the entire number looking at pairs (n-th and (n+1)-th terms), if (n+1)-th is > than n-th, take the difference and write it down. If term (n+1) = n-th term, write down a "0". %C A147995 If term (n+1) < n-th term we ADD N (as N-Ary) to (n+1)-th term then take the difference. Examples: %C A147995 Find the Gray code counterpart to 2 1 base 4 = 9 decimal. %C A147995 Ans.: next term (1) < (2) so we add 4 to the 1 getting 5, then take (5 - 2) = 3. So given 4-Ary 21, the corresponding Gray code term = 23 %C A147995 . %C A147995 Find the Gray code counterpart to binary 10110 = 22 decimal. First, go through the terms writing down the difference if next term > current: (and writing "0" if next term = current term) %C A147995 1, 0, 1, 1, 0 %C A147995 1.....1..0... %C A147995 Add "2" to the terms above the vacant places and take the difference from previous term, top row: %C A147995 1, 1, 1, 0, 1 final result = Gray code for 22 decimal. %C A147995 . %C A147995 Given 8-Ary number 3156647, base 8. Using steps (1-2) we get %C A147995 3, 1, 5, 6, 6, 4, 7 %C A147995 3.....4..1..0.....3; then add 8 to top term for vacant places then take the difference, getting: %C A147995 3..6..4..1..0..6..3; = 8-ary Gray code given 8-Ary (3 1 5 6 6 4 7). %C A147995 . %C A147995 Given the foregoing rules and examples, access the charts accompanying the DNA codons. 3 digit terms = 4-Ary Gray code. Convert 133 (bottom row) to 4-Ary then to decimal. We get: %C A147995 1 %C A147995 1 0 3 = (16 + 0 + 3) = 19 %C A147995 Convert 39 decimal to 4-Ary then to 4-Ary Gray code. 39 = 213 4-Ary = (2*16 + 4 + 3); then %C A147995 2 1 3 %C A147995 2...2; then add "4" to the 1 and take the difference = (5 - 2) = 3. = 2 3 2 = 4-Ary Gray code for decimal 39 as shown in the dual charts, next to bottom row, third from the right: (232 corresponds to 39) in the accompanying chart. %C A147995 Properties of Gray code: sum of terms MOD N = decimal MOD N. Example: 232 corresponds to 19, then (2 + 3 + 2) MOD 4 = 3, and 19 == 3 MOD 4. %C A147995 Another property: Highest exponent of N dividing a decimal term. %C A147995 Access term (n-1) writing the Gray code on the top row and Gray code for n-th term on the bottom. Determine column change = (0, 1, 2, ...) starting from the right. Let the column = c. then c is the highest exponent of N dividing n-th term. Examples: 40 in 4-Ary Gray code = 202, while 41 = 203. Change is in column 0 so 203 can be divided by 4^0. But 44 in 4-Ary Gray code = 211 while 43 = 201. Bit change is in column 1 so 4^1 divides 44. (End) %D A147995 Clifford A. Pickover, The Zen of Magic Squares, Circles, and Stars: An Exhibition of Surprising Structures across Dimensions, Princeton University Press, 2002, pp. 285-289. %H A147995 A. Karttunen, <a href="/A147995/b147995.txt">Table of n, a(n) for n = 0..8255</a> %H A147995 Jay Kappraff and Gary W. Adamson, <a href="https://m.njit.edu/CAMS/Technical_Reports/CAMS08_09/report0809-12.pdf">Generalized Genomic Matrices, Silver Means, & Pythagorean Triples</a>, FORMA 2009, v24 p.41-48. %H A147995 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A147995 M = {{0, 3, 14, 15, 58, 57, 62, 63}, {1, 2, 13, 12, 59, 56, 61, 60}, {6, 7, 8, 11, 54, 55, 50, 49}, {5, 4, 9, 10, 53, 52, 51, 48}, {26, 25, 30, 31, 32, 35, 46, 47}, {27, 24, 29, 28, 33, 34, 45, 44}, {22, 23, 18, 17, 38, 39, 40, 43}, {21, 20, 19, 16, 37, 36, 41, 42}}; t(n,m) = antidiagonal(M). %F A147995 a(n) = A163485(A057300(A054238(n))). - _Antti Karttunen_, Aug 01 2009 %e A147995 Antidiagonals begin: %e A147995 { 0}, %e A147995 { 1, 3}, %e A147995 { 6, 2, 14}, %e A147995 { 5, 7, 13, 15}, %e A147995 {26, 4, 8, 12, 58}, %e A147995 {27, 25, 9, 11, 59, 57}, %e A147995 {22, 24, 30, 10, 54, 56, 62}, %e A147995 {21, 23, 29, 31, 53, 55, 61, 63} %t A147995 M = {{0, 3, 14, 15, 58, 57, 62, 63}, {1, 2, 13, 12, 59, 56, 61, 60}, {6, 7, 8, 11, 54, 55, 50, 49}, {5, 4, 9, 10, 53, 52, 51, 48}, {26, 25, 30, 31, 32, 35, 46, 47}, {27, 24, 29, 28, 33, 34, 45, 44}, {22, 23, 18, 17, 38, 39, 40, 43}, {21, 20, 19, 16, 37, 36, 41, 42}}; Table[Table[M[[n - m + 1, m]], {m, 1, n}], {n, 1, Length[M]}]; Flatten[%] %Y A147995 a(n) = A163545(A061579(n)), i.e., transpose of A163545. Antidiagonal sums: A163484. Inverse: A163544. See also A163233, A163235, A163237, A163239, A163357, A163359. %Y A147995 Cf. A088696. - _Gary W. Adamson_, Aug 08 2009 %K A147995 nonn,tabl,obsc,look %O A147995 0,3 %A A147995 _Roger L. Bagula_ and _Gary W. Adamson_, Nov 18 2008 %E A147995 Edited, extended, keywords tabl and obsc added and offset changed from 1 to 0 by _Antti Karttunen_, Aug 01 2009