cp's OEIS Frontend

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.

Showing 1-10 of 29 results. Next

A300838 Permutation of nonnegative integers: a(n) = A057300(A003188(n)).

Original entry on oeis.org

0, 2, 3, 1, 9, 11, 10, 8, 12, 14, 15, 13, 5, 7, 6, 4, 36, 38, 39, 37, 45, 47, 46, 44, 40, 42, 43, 41, 33, 35, 34, 32, 48, 50, 51, 49, 57, 59, 58, 56, 60, 62, 63, 61, 53, 55, 54, 52, 20, 22, 23, 21, 29, 31, 30, 28, 24, 26, 27, 25, 17, 19, 18, 16, 144, 146, 147, 145, 153, 155, 154, 152, 156, 158, 159, 157, 149, 151
Offset: 0

Views

Author

Antti Karttunen and Peter Munn, Apr 15 2018

Keywords

Comments

Like in binary Gray code A003188, also in this permutation the binary expansions of a(n) and a(n+1) differ always by just a single bit-position, that is, A000120(A003987(a(n),a(n+1))) = 1 for all n >= 0. Here A003987 computes bitwise-XOR of its two arguments. This is true for any composition P(A003188(n)), where P is a permutation that permutes the bit-positions of binary expansion of n in some way.
When composed with A052330 this gives a divisor-or-multiple permutation similar to A207901 and A302781.

Crossrefs

Cf. A300839 (inverse permutation).
Cf. also A003188, A163252, A302846 for other permutations satisfying the same condition.

Programs

  • PARI
    A003188(n) = bitxor(n, n>>1);
    A057300(n) = { my(t=1, s=0); while(n>0,  if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A300838(n) = A057300(A003188(n));

Formula

a(n) = A057300(A003188(n)).

A126008 Involution of nonnegative integers: composition of involutions A057300 and A126007.

Original entry on oeis.org

0, 2, 1, 3, 32, 34, 33, 35, 16, 18, 17, 19, 48, 50, 49, 51, 8, 10, 9, 11, 40, 42, 41, 43, 24, 26, 25, 27, 56, 58, 57, 59, 4, 6, 5, 7, 36, 38, 37, 39, 20, 22, 21, 23, 52, 54, 53, 55, 12, 14, 13, 15, 44, 46, 45, 47, 28, 30, 29, 31, 60, 62, 61, 63, 512, 514, 513, 515, 544, 546
Offset: 0

Views

Author

Antti Karttunen, Jan 02 2007

Keywords

Crossrefs

a(n) = A057300(A126007(n)) = A126007(A057300(n)). The first 64 terms are identical with A106485.

A300839 Permutation of nonnegative integers: a(n) = A006068(A057300(n)).

Original entry on oeis.org

0, 3, 1, 2, 15, 12, 14, 13, 7, 4, 6, 5, 8, 11, 9, 10, 63, 60, 62, 61, 48, 51, 49, 50, 56, 59, 57, 58, 55, 52, 54, 53, 31, 28, 30, 29, 16, 19, 17, 18, 24, 27, 25, 26, 23, 20, 22, 21, 32, 35, 33, 34, 47, 44, 46, 45, 39, 36, 38, 37, 40, 43, 41, 42, 255, 252, 254, 253, 240, 243, 241, 242, 248, 251, 249, 250, 247, 244, 246, 245, 192
Offset: 0

Views

Author

Antti Karttunen, Apr 15 2018

Keywords

Crossrefs

Cf. A300838 (inverse permutation).

Programs

  • PARI
    A006068(n)= { my(s=1, ns); while(1, ns = n >> s; if(0==ns, break()); n = bitxor(n, ns); s <<= 1; ); return (n); } \\ From A006068
    A057300(n) = { my(t=1, s=0); while(n>0,  if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A300839(n) = A006068(A057300(n));

Formula

a(n) = A006068(A057300(n)).

A059905 Index of first half of decomposition of integers into pairs based on A000695.

Original entry on oeis.org

0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 4, 5, 4, 5, 6, 7, 6, 7, 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15, 12, 13, 12, 13, 14
Offset: 0

Views

Author

Marc LeBrun, Feb 07 2001

Keywords

Comments

One coordinate of a recursive non-self-intersecting walk on the square lattice Z^2.

Examples

			A000695(a(14)) + 2*A000695(A059906(14)) = A000695(2) + 2*A000695(3) = 4 + 2*5 = 14.
If n=27, then b_0=1, b_1=1, b_2=0, b_3=1, b_4=1. Therefore a(27) = b_0 + b_2*2 + b_4*2^2 = 5. - _Vladimir Shevelev_, Nov 13 2008
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local L; L:= convert(n,base,2); add(L[2*i+1]*2^i,i=0..floor((nops(L)-1)/2)) end;
    map(f, [$0..256]); # Robert Israel, Aug 12 2015
  • Mathematica
    a[n_] := Module[{P}, (P = Partition[IntegerDigits[2n, 2]//Reverse, 2][[All, 2]]).(2^(Range[Length[P]]-1))]; Array[a, 100, 0] (* Jean-François Alcover, Apr 24 2019 *)
  • PARI
    A059905(n) = { my(t=1,s=0); while(n>0, s += (n%2)*t; n \= 4; t *= 2); (s); }; \\ Antti Karttunen, Apr 14 2018
  • Python
    def a(n): return sum([(n>>2*i&1)<Indranil Ghosh, Jun 25 2017, after Ruby code by Peter Kagey
    
  • Python
    def A059905(n): return int(bin(n)[:1:-2][::-1],2) # Chai Wah Wu, Jun 30 2022
    
  • Ruby
    def a(n)
      (0..n.bit_length/2).to_a.map { |i| (n >> 2 * i & 1) << i}.reduce(:+)
    end # Peter Kagey, Aug 12 2015
    

Formula

n = A000695(a(n)) + 2*A000695(A059906(n)).
To get a(n), write n as Sum b_j*2^j, then a(n) = Sum b_(2j)*2^j. - Vladimir Shevelev, Nov 13 2008
a(n) = Sum_{k>=0} A030308(n,k)*A077957(k). - Philippe Deléham, Oct 18 2011
G.f.: (1-x)^(-1) * Sum_{j>=0} 2^j*x^(2^j)/(1+x^(2^j)). - Robert Israel, Aug 12 2015
a(n) = A059906(2*n). - Velin Yanev, Dec 01 2016

A059906 Index of second half of decomposition of integers into pairs based on A000695.

Original entry on oeis.org

0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3, 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3, 4, 4, 5, 5, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, 4, 4, 5, 5, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3, 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3, 4, 4, 5, 5, 4, 4, 5, 5, 6
Offset: 0

Author

Marc LeBrun, Feb 07 2001

Keywords

Comments

One coordinate of a recursive non-self-intersecting walk on the square lattice Z^2.

Examples

			A000695(A059905(14)) + 2*A000695(a(14)) = A000695(2) + 2*A000695(3) = 4 + 2*5 = 14.
If n=27, then b_0=1, b_1=1, b_2=0, b_3=1, b_4=1. Therefore a(27) = b_1 + b_3*2 = 3. - _Vladimir Shevelev_, Nov 13 2008
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{P}, (P = Partition[IntegerDigits[n, 2]//Reverse, 2][[All, 2]]).(2^(Range[Length[P]]-1))]; Array[a, 105, 0] (* Jean-François Alcover, Apr 24 2019 *)
  • PARI
    A059906(n) = { my(t=1,s=0); while(n>0, s += ((n%4)>=2)*t; n \= 4; t *= 2); (s); }; \\ Antti Karttunen, Apr 14 2018
  • Python
    def a(n):
        x=[int(t) for t in list(bin(n)[2:])[::-1]]
        return sum(x[2*i + 1]*2**i for i in range(int(len(x)//2)))
    print([a(n) for n in range(105)]) # Indranil Ghosh, Jun 25 2017
    
  • Python
    def A059906(n): return 0 if n < 2 else int(bin(n)[-2:1:-2][::-1],2) # Chai Wah Wu, Jun 30 2022
    

Formula

n = A000695(A059905(n)) + 2*A000695(a(n))
To get a(n), write n as Sum b_j*2^j, then a(n) = Sum b_(2j+1)*2^j. - Vladimir Shevelev, Nov 13 2008
a(n) = Sum_{k>=0} A030308(n,k)*b(k) with b(0)=0 and b(k)=A077957(k-1) for k>0. - Philippe Deléham, Oct 18 2011
Conjecture: a(n) = n - (1/2)*Sum_{k=1..n} (sqrt(2)^A007814(k) + (-sqrt(2))^A007814(k)) = -Sum_{k=1..n} (-1)^k * 2^floor(k/2) * floor(n/2^k). - Velin Yanev, Dec 01 2016

A163355 Permutation of integers for constructing Hilbert curve in N x N grid.

Original entry on oeis.org

0, 1, 3, 2, 14, 15, 13, 12, 4, 7, 5, 6, 8, 11, 9, 10, 16, 19, 17, 18, 20, 21, 23, 22, 30, 29, 31, 28, 24, 25, 27, 26, 58, 57, 59, 56, 54, 53, 55, 52, 60, 61, 63, 62, 50, 51, 49, 48, 32, 35, 33, 34, 36, 37, 39, 38, 46, 45, 47, 44, 40, 41, 43, 42, 234, 235, 233, 232, 236, 239
Offset: 0

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163356. A163357 & A163359 give two variants of Hilbert curve in N x N grid. Cf. also A163332.
Second and third "powers": A163905, A163915.
In range [A000302(n-1)..A024036(n)] of this permutation, the number of cycles is given by A163910, number of fixed points seems to be given by A147600(n-1) (fixed points themselves: A163901). Max. cycle sizes is given by A163911 and LCM's of all cycle sizes by A163912.

Programs

  • Maple
    A057300 := proc(n)
        option remember;
        `if`(n=0, 0, procname(iquo(n, 4, 'r'))*4+[0, 2, 1, 3][r+1])
    end proc:
    A163355 := proc(n)
        option remember ;
        local d,base4,i,r ;
        if n <= 1 then
            return n ;
        end if;
        base4 := convert(n,base,4) ;
        d := op(-1,base4) ;
        i := nops(base4)-1 ;
        r := n-d*4^i ;
        if ( d=1 and type(i,even) ) or ( d=2 and type(i,odd)) then
            4^i+procname(A057300(r)) ;
        elif d= 3 then
            2*4^i+procname(A057300(r)) ;
        else
            3*4^i+procname(4^i-1-r) ;
        end if;
    end proc:
    seq(A163355(n),n=0..100) ; # R. J. Mathar, Nov 22 2023
  • PARI
    A057300(n) = { my(t=1, s=0); while(n>0,  if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A163355(n) = if(!n,n,my(i = (#binary(n)-1)\2, f = 4^i, d = (n\f)%4, r = (n%f)); if(((1==d)&&!(i%2))||((2==d)&&(i%2)), f+A163355(A057300(r)), if(3==d,f+f+A163355(A057300(r)), (3*f)+A163355(f-1-r)))); \\ Antti Karttunen, Apr 14 2018

Formula

a(0) = 0, and given d=1, 2 or 3, then a((d*(4^i))+r)
= (4^i) + a(A057300(r)), if d=1 and i is even, or if d=2 and i is odd
= 2*(4^i) + a(A057300(r)), if d=3,
= 3*(4^i) + a((4^i)-1-r) in other cases.
From Alan Michael Gómez Calderón, May 06 2025: (Start)
a(3*A000695(n)) = 2*A000695(n);
a(3*(A000695(n) + 2^A000695(2*m))) = 2*(A000695(n) + 2^A000695(2*m)) for m >= 2;
a((2 + 16^n)*2^(-1 + 4*m)) = 4^(2*(n + m) - 1) + (11*16^m - 2)/3. (End)

Extensions

Links to further derived sequences added by Antti Karttunen, Sep 21 2009

A163356 Inverse permutation to A163355, related to Hilbert's curve in N x N grid.

Original entry on oeis.org

0, 1, 3, 2, 8, 10, 11, 9, 12, 14, 15, 13, 7, 6, 4, 5, 16, 18, 19, 17, 20, 21, 23, 22, 28, 29, 31, 30, 27, 25, 24, 26, 48, 50, 51, 49, 52, 53, 55, 54, 60, 61, 63, 62, 59, 57, 56, 58, 47, 46, 44, 45, 39, 37, 36, 38, 35, 33, 32, 34, 40, 41, 43, 42, 128, 130, 131, 129, 132, 133
Offset: 0

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163355.
Second and third "powers": A163906, A163916. See also A059252-A059253.
In range [A000302(n-1)..A024036(n)] of this permutation, the number of cycles is given by A163910, number of fixed points seems to be given by A147600(n-1) (fixed points themselves: A163901). Max. cycle sizes is given by A163911 and LCM's of all cycle sizes by A163912.
Cf. also A302844, A302846, A302781.

Programs

  • PARI
    A057300(n) = { my(t=1,s=0); while(n>0, if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A163356(n) = if(!n,n,my(i = (#binary(n)-1)\2, f = 4^i, d = (n\f)%4, r = (n%f)); (((((2+(i%2))^d)%5)-1)*f) + if(3==d,f-1-A163356(r),A057300(A163356(r)))); \\ Antti Karttunen, Apr 14 2018

Formula

a(0) = 0, and provided that d=1, 2 or 3, then a((d*(4^i))+r) = (((2+(i mod 2))^d mod 5)-1) * [either A024036(i) - a(r), if d is 3, and A057300(a(r)) in other cases].
From Antti Karttunen, Apr 14 2018: (Start)
A059905(a(n)) = A059253(n).
A059906(a(n)) = A059252(n).
a(n) = A000695(A059253(n)) + 2*A000695(A059252(n)).
(End)

Extensions

Links to further derived sequences and a nicer Scheme function & formula added by Antti Karttunen, Sep 21 2009

A302846 Interleave the Gray-coded X and Y-coordinates of 2-dimensional Hilbert's curve in alternate bit-positions: a(n) = A000695(A003188(A059253(n))) + 2*A000695(A003188(A059252(n))).

Original entry on oeis.org

0, 1, 3, 2, 10, 8, 9, 11, 15, 13, 12, 14, 6, 7, 5, 4, 20, 22, 23, 21, 17, 16, 18, 19, 27, 26, 24, 25, 29, 31, 30, 28, 60, 62, 63, 61, 57, 56, 58, 59, 51, 50, 48, 49, 53, 55, 54, 52, 36, 37, 39, 38, 46, 44, 45, 47, 43, 41, 40, 42, 34, 35, 33, 32, 160, 162, 163, 161, 165, 164, 166, 167, 175, 174, 172, 173, 169, 171, 170, 168, 136
Offset: 0

Author

Antti Karttunen, Apr 14 2018

Keywords

Comments

Like in binary Gray code A003188, also in this permutation the binary expansions of a(n) and a(n+1) differ always by just a single bit-position, that is, A000120(A003987(a(n),a(n+1))) = 1 for all n >= 0. Here A003987 computes bitwise-XOR of its two arguments.
When composed with A052330 this gives A302781.

Crossrefs

Cf. A302845 (inverse permutation).
Cf. also A003188, A163252, A300838 for other permutations satisfying the same condition.

Programs

  • PARI
    A064706(n) = bitxor(n, n>>2);
    A057300(n) = { my(t=1,s=0); while(n>0, if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A163356(n) = if(!n,n,my(i = (#binary(n)-1)\2, f = 4^i, d = (n\f)%4, r = (n%f)); (((((2+(i%2))^d)%5)-1)*f) + if(3==d,f-1-A163356(r),A057300(A163356(r))));
    A302846(n) = A064706(A163356(n));

Formula

a(n) = A064706(A163356(n)) = A003188(A302844(n)).

A147995 Array of N X N grid hopping "almost-walk", read by antidiagonals.

Original entry on oeis.org

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, 56, 62, 21, 23, 29, 31, 53, 55, 61, 63, 106, 20, 18, 28, 32, 52, 50, 60, 234, 107, 105, 19, 17, 33, 35, 51, 49, 235, 233, 108, 104, 100, 16, 38, 34, 46, 48, 236, 232, 228, 111
Offset: 0

Author

Roger L. Bagula and Gary W. Adamson, Nov 18 2008

Keywords

Comments

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."
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.)
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:
CCC CCU CUU CUC UUC UUU UCU UCC
CCA CCG CUG CUA UUA UUG UCG UCA
CAA CAG CGG CGA UGA UGG UAG UAA
CAC CAU CGU CGC UGC UGU UAU UAC
AAC AAU AGU AGC GGC GGU GAU GAC
AAA AAG AGG AGA GGA GGG GAG GAA
ACA ACG AUG AUA GUA GUG GCG GCA
ACC ACU AUU AUC GUC GUU GCU GCC
2) Using the conversion rules: 0 = C, 1 = A, 2 = G, 3 = U, we convert to 4-ary gray code:
000 003 033 030 330 333 303 300
001 002 032 031 331 332 302 301
011 012 022 021 321 322 312 311
010 013 023 020 320 323 313 310
110 113 123 120 220 223 213 210
111 112 122 121 221 222 212 211
101 102 132 131 231 232 202 201
100 103 133 130 230 233 203 200
3) To convert back to decimal:
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
... 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.
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.
From Gary W. Adamson, Aug 04 2009: (Start)
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.
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:
.
000...001...011...010...110...111...101...100
000...000...000...000...000...000...000...000
CCC...CCU...CUU...CUC...UUC...UUU...UCU...UCC
000...001...011...010...110...111...101...100
001...001...001...001...001...001...001...001
CCA...CCG...CUG...CUA...UUA...UUG...UCG...UCA
000...001...011...010...110...111...101...100
011...011...011...011...011...011...011...011
CAA...CAG...CGG...CGA...UGA...UGG...UAG...UAA
000...001...011...010...110...111...101...100
010...010...010...010...010...010...010...010
CAC...CAU...CGU...CGC...UGC...UGU...UAU...UAC
000...001...011...010...110...111...101...100
110...110...110...110...110...110...110...110
AAC...AAU...AGU...AGC...GGC...GGU...GAU...GAC
000...001...011...010...110...111...101...100
111...111...111...111...111...111...111...111
AAA...AAG...AGG...AGA...GGA...GGG...GAG...GAA
000...001...011...010...110...111...101...100
101...101...101...101...101...101...101...101
ACA...ACG...AUG...AUA...GUA...GUG...GCG...GCA
000...001...011...010...110...111...101...100
100...100...100...100...100...100...100...100
ACC...ACU...AUU...AUC...GUC...GUU...GCU...GCC
.
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.
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).
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.
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.
This gives following array which we superimpose on the Codon array, giving the correct number of Hydrogen bonds for each Codon and anti-Codon:
.
9 8 7 8 7 6 7 8
8 9 8 7 6 7 8 7
7 8 9 8 7 8 7 6
8 7 8 9 8 7 6 7
7 6 7 8 9 8 7 8
6 7 8 7 8 9 8 7
6 8 7 6 7 8 9 8
8 7 6 7 8 7 8 9
... (a semi-magic square with a binomial distribution of (1, 3, 3, 1) as to (6, 7, 8, 9) in every row and column.
Example: CUG (3rd from left, row next to top) has (C=3, U=2, G=3), total 8.
The anti-Codon of CUG = GAC and likewise has 8 hydrogen bonds. (End)
From Gary W. Adamson, Aug 04 2009: (Start)
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:
.
0 CCC; 16 AUC; 32 GGC; 48 UAC
1 CCA; 17 AUA; 33 GGA; 49 UAA
2 CCG; 18 AUG; 34 GGG; 50 UAG
3 CCU; 19 AUU; 35 GGU; 51 UAU
4 CAU; 20 ACU; 36 GUU; 52 UGU
5 CAC; 21 ACC; 37 GUC; 53 UGC
6 CAA; 22 ACA; 38 GUA; 54 UGA
7 CAG; 23 ACG; 39 GUG; 55 UGG
8 CGG; 24 AAG; 40 GCG; 56 UUG
9 CGU; 25 AAU; 41 GCU; 57 UUU
10 CGC; 26 AAC; 42 GCC; 58 UUC
11 CGA; 27 AAA; 43 GCA; 59 UUA
12 CUA; 28 AGA; 44 GAA; 60 UCA
13 CUG; 29 AGG; 45 GAG; 61 UCG
14 CUU; 30 AGU; 46 GAU; 62 UCU
15 CUC; 31 AGC; 47 GAC; 63 UCC
(End)
From Gary W. Adamson, Aug 08 2009: (Start)
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)
From Gary W. Adamson, Aug 13 2009: (Start)
Gray code -> <- Binary conversion rules: in either direction for any base; "N-Ary Gray code" -> "N-ary" or in the other direction.
.
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.
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:
Convert Gray code base 8, 3641063 to 8-ary. This gives initially,
3..................
3..6..4..1..0..6..3
.
Then (3 + 6) MOD 8 = 1 so we place a "1" above the 6 going to the right.
Then (1 + 4) MOD 8 = 5 so we place a "5" above the 5.
Continuing with this procedure, we obtain:
3 1 5 6 6 4 7 8-Ary
3 6 4 1 0 6 3 8-Ary Gray code
.
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:
1
1 3 3
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.
.
Rules for converting an N-Ary number to the corresponding N-Ary Gray code:
As before, we place the N-Ary on the top row with ongoing results on the bottom row = N-Ary Gray code.
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".
If term (n+1) < n-th term we ADD N (as N-Ary) to (n+1)-th term then take the difference. Examples:
Find the Gray code counterpart to 2 1 base 4 = 9 decimal.
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
.
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)
1, 0, 1, 1, 0
1.....1..0...
Add "2" to the terms above the vacant places and take the difference from previous term, top row:
1, 1, 1, 0, 1 final result = Gray code for 22 decimal.
.
Given 8-Ary number 3156647, base 8. Using steps (1-2) we get
3, 1, 5, 6, 6, 4, 7
3.....4..1..0.....3; then add 8 to top term for vacant places then take the difference, getting:
3..6..4..1..0..6..3; = 8-ary Gray code given 8-Ary (3 1 5 6 6 4 7).
.
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:
1
1 0 3 = (16 + 0 + 3) = 19
Convert 39 decimal to 4-Ary then to 4-Ary Gray code. 39 = 213 4-Ary = (2*16 + 4 + 3); then
2 1 3
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.
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.
Another property: Highest exponent of N dividing a decimal term.
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)

Examples

			Antidiagonals begin:
  { 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, 56, 62},
  {21, 23, 29, 31, 53, 55, 61, 63}
		

References

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

Crossrefs

a(n) = A163545(A061579(n)), i.e., transpose of A163545. Antidiagonal sums: A163484. Inverse: A163544. See also A163233, A163235, A163237, A163239, A163357, A163359.
Cf. A088696. - Gary W. Adamson, Aug 08 2009

Programs

  • Mathematica
    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[%]

Formula

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).
a(n) = A163485(A057300(A054238(n))). - Antti Karttunen, Aug 01 2009

Extensions

Edited, extended, keywords tabl and obsc added and offset changed from 1 to 0 by Antti Karttunen, Aug 01 2009

A302781 Divisor-or-multiple permutation of natural numbers constructed from two-dimensional Hilbert curve (A163357) and Fermi-Dirac primes (A050376).

Original entry on oeis.org

1, 2, 6, 3, 15, 5, 10, 30, 120, 40, 20, 60, 12, 24, 8, 4, 28, 84, 168, 56, 14, 7, 21, 42, 210, 105, 35, 70, 280, 840, 420, 140, 1260, 3780, 7560, 2520, 630, 315, 945, 1890, 378, 189, 63, 126, 504, 1512, 756, 252, 36, 72, 216, 108, 540, 180, 360, 1080, 270, 90, 45, 135, 27, 54, 18, 9, 117, 351, 702, 234, 936, 468
Offset: 0

Author

Antti Karttunen, Apr 14 2018

Keywords

Comments

Note that the starting offset is 0, to align with A052330 and A207901.
Shares with A064736, A207901, A298480, A302350, A302783, A303771, etc. the property that a(n) is either a divisor or a multiple of a(n+1). Permutations satisfying such property are called "divisor-or-multiple permutations" in the OEIS, although Mazet & Saias call them "chain permutations" in their paper. [Edited by Antti Karttunen, Aug 26 2018]
One way to construct such permutations is by composing A052330 from the right with any such permutation like A003188 or A302846 where the binary expansions of a(n) and a(n+1) always differ by just a single bit-position.
Further permutations satisfying the same condition could be constructed from higher-dimensional versions (i.e., greater than 2) of Hilbert's space-filling curves, where the coordinates of each dimension would be Gray coded separately and then interleaved together. Permutation A207901 is essentially a one-dimensional variant of the same idea, while this is constructed from the 2-dimensional curve A163357, which is a Hamiltonian path on N X N grid.
See Peter Munn's A300012 for another idea for constructing such a permutation. - Antti Karttunen, Aug 26 2018

Programs

  • PARI
    up_to_e = 14;
    v050376 = vector(up_to_e);
    A050376(n) = v050376[n];
    ispow2(n) = (n && !bitand(n,n-1));
    i = 0; for(n=1,oo,if(ispow2(isprimepower(n)), i++; v050376[i] = n); if(i == up_to_e,break));
    A052330(n) = { my(p=1,i=1); while(n>0, if(n%2, p *= A050376(i)); i++; n >>= 1); (p); };
    A064706(n) = bitxor(n, n>>2);
    A057300(n) = { my(t=1,s=0); while(n>0, if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A163356(n) = if(!n,n,my(i = (#binary(n)-1)\2, f = 4^i, d = (n\f)%4, r = (n%f)); (((((2+(i%2))^d)%5)-1)*f) + if(3==d,f-1-A163356(r),A057300(A163356(r))));
    A302781(n) = A052330(A064706(A163356(n)));

Formula

a(n) = A052330(A302846(n)), where A302846(n) = A000695(A003188(A059253(n))) + 2*A000695(A003188(A059252(n))).

Extensions

Name edited by Antti Karttunen, Aug 26 2018
Showing 1-10 of 29 results. Next