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-7 of 7 results.

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

Views

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

Views

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

A163901 The positions i where A163355(i) = i, that is, the fixed points of permutation A163355.

Original entry on oeis.org

0, 1, 16, 20, 21, 256, 260, 261, 320, 321, 336, 340, 341, 4096, 4100, 4101, 4160, 4161, 4176, 4180, 4181, 5120, 5121, 5136, 5140, 5141, 5376, 5380, 5381, 5440, 5441, 5456, 5460, 5461, 65536, 65540, 65541, 65600, 65601, 65616, 65620, 65621
Offset: 0

Views

Author

Antti Karttunen, Sep 19 2009

Keywords

Comments

Alternatively, the positions of zeros in A163900.

Crossrefs

a(n) = A000695(A165404(n)). Same sequence in base-4: A165406. See also A163902, A163903, A163910.

A163912 Least common multiple of all cycle sizes in range [A000302(n-1)..A024036(n)] of permutation A163355/A163356.

Original entry on oeis.org

1, 2, 6, 24, 36, 288, 432, 1728, 2592, 31104, 15552
Offset: 0

Views

Author

Antti Karttunen, Sep 19 2009

Keywords

Crossrefs

A163911 Maximum cycle size in range [A000302(n-1)..A024036(n)] of permutation A163355/A163356.

Original entry on oeis.org

1, 2, 6, 8, 18, 32, 108, 216, 324, 1944, 1944
Offset: 0

Views

Author

Antti Karttunen, Sep 19 2009

Keywords

Crossrefs

A163903 The positions i where A163915(i) = i, but not A163355(i) = i, that is, the 3-cycles of permutation A163355.

Original entry on oeis.org

5, 6, 10, 11, 13, 15, 17, 18, 19, 80, 81, 85, 86, 90, 91, 93, 95, 105, 106, 160, 161, 165, 166, 170, 171, 173, 175, 190, 191, 213, 215, 240, 241, 245, 246, 250, 251, 253, 255, 257, 258, 259, 276, 277, 278, 279, 282, 296, 297, 298, 299, 303, 309, 316, 317, 318
Offset: 0

Views

Author

Antti Karttunen, Sep 19 2009

Keywords

Crossrefs

A163902 The positions i where A163905(i) = i, but not A163355(i) = i, that is, the 2-cycles of permutation A163355.

Original entry on oeis.org

2, 3, 22, 23, 25, 26, 29, 31, 37, 38, 40, 41, 42, 43, 53, 55, 60, 61, 62, 63, 262, 263, 265, 266, 269, 271, 322, 323, 342, 343, 345, 346, 349, 351, 357, 358, 360, 361, 362, 363, 373, 375, 380, 381, 382, 383, 405, 406, 408, 409, 410, 411, 416, 420, 421, 422
Offset: 0

Views

Author

Antti Karttunen, Sep 19 2009

Keywords

Crossrefs

See also A163901, A163903, A163910.
Showing 1-7 of 7 results.