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.

User: 18 18 [6 | 6] 22 22

18 18 [6 | 6] 22 22 's wiki page.

18 18 [6 | 6] 22 22 has authored 31 sequences. Here are the ten most recent ones:

A376686 a(n) is the unique k such that A376677(k) is the reversal of A376677(n), or -1 if no such k exists.

Original entry on oeis.org

1, 2, 3, 5, 4, 6, 10, 8, 12, 7, 11, 9, 15, 21, 13, 19, 17, 18, 16, 22, 14, 20, 23, 32, 28, 30, 35, 25, 33, 26, 34, 24, 29, 31, 27, 36, 46, 53, 50, 40, 52, 44, 48, 42, 54, 37, 49, 43, 47, 39, 51, 41, 38, 45, 60, 76, 66, 63, 79, 55, 71, 65, 58, 74, 62, 57, 67
Offset: 1

Author

Rémy Sigrist, Oct 01 2024

Keywords

Comments

Is this sequence a permutation of the positive integers?

Examples

			The first terms, alongside the corresponding terms of A376677, are:
  n   a(n)  A376677(n)  A376677(a(n))
  --  ----  ----------  -------------
   1     1           1              1
   2     2           2              2
   3     3          11             11
   4     5          12             21
   5     4          21             12
   6     6          22             22
   7    10         112            211
   8     8         121            121
   9    12         122            221
  10     7         211            112
  11    11         212            212
  12     9         221            122
  13    15        1121           1211
  14    21        1122           2211
  15    13        1211           1121
  16    19        1212           2121
		

Crossrefs

Programs

  • PARI
    \\ See Links section.

A376685 a(n) is the unique k such that A376637(k) is the reversal of A376637(n).

Original entry on oeis.org

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

Author

Rémy Sigrist, Oct 01 2024

Keywords

Comments

This sequence is a self-inverse permutation of the positive integers.

Examples

			The first terms, alongside the corresponding terms of A376637, are:
  n   a(n)  A376637(n)  A376637(a(n))
  --  ----  ----------  -------------
   1     1           1              1
   2     2           2              2
   3     3          11             11
   4     5          12             21
   5     4          21             12
   6     6          22             22
   7     9         112            211
   8    10         122            221
   9     7         211            112
  10     8         221            122
  11    13        1121           1211
  12    15        1122           2211
  13    11        1211           1121
  14    16        2122           2212
  15    12        2211           1122
  16    14        2212           2122
		

Crossrefs

Programs

  • PARI
    \\ See Links section.

Formula

A376637(a(n)) = A004086(A376637(n)).

A371597 a(n) is the sum of k where A063655(k) = n.

Original entry on oeis.org

0, 1, 2, 7, 6, 22, 22, 38, 52, 70, 58, 141, 104, 188, 230, 281, 260, 320, 374, 531, 526, 717, 566, 927, 756, 1017, 1114, 1203, 1148, 1799, 1402, 1741, 1718, 2170, 2314, 2765, 2400, 2912, 2800, 3769, 2856, 4577, 3352, 4923, 4410, 5054, 5036, 6346, 6246, 5537
Offset: 1

Author

Adnan Baysal, Mar 28 2024

Keywords

Comments

Construct the same directed graph as in A369793. a(n) is the sum of vertices directed to the vertex n in this graph.

Examples

			a(1) = 0 since 1 does not exist in A063655.
a(2) = 1 because there is only one integral rectangle of area 1 with a minimal semiperimeter 2, which is the 1 X 1 square. So 2 appears only once in A063655 at index 1, which means a(2) = 1.
a(4) = 7, because only A063655(3) and A063655(4) have the value 4. For any n > 4, A063655(n) > 4, because A063655(n) > 2 * sqrt(n) > 2 * sqrt(4) = 4. Hence, 4 cannot appear in the rest of A063655.
		

Crossrefs

Programs

  • Python
    from sympy import divisors
    def A371597(n): return sum(m for m in range(1, (n**2>>2)+1) if (d:=divisors(m))[((l:=len(d))-1)>>1]+d[l>>1]==n)

A357046 Squares visited by a knight moving on a board covered with horizontal dominoes [m|m], m = 0, 1, 2, ... in a diamond-shaped spiral, when the knight always jumps to the unvisited square with the least number on the corresponding domino.

Original entry on oeis.org

0, 11, 14, 1, 4, 13, 10, 3, 18, 7, 2, 5, 22, 9, 28, 31, 60, 15, 32, 29, 52, 25, 8, 27, 12, 53, 26, 23, 6, 17, 34, 59, 30, 87, 126, 51, 24, 45, 20, 39, 16, 33, 58, 55, 86, 125, 50, 47, 76, 21, 40, 67, 36, 61, 94, 57, 54, 85, 176, 129, 56, 93, 138, 187, 92, 137, 96, 35, 38, 19
Offset: 0

Author

M. F. Hasler, Oct 19 2022

Keywords

Comments

The sequence lists the squares visited by the knight by giving their (unique) "square spiral number", as shown, e.g., in A316328 and others. (Listing the labels m of the dominoes would obviously be ambiguous; see EXAMPLE for that sequence.)
The dominoes [m|m], m = 0, 1, 2, ... are placed in a diamond-shaped spiral,
12 12 28 28
_ 13 13 11 11 27 27 _
14 14 [2 | 2] 10 10 26 26
_ 15 15 [3 | 3] [1 | 1] [9 | 9] 25
_ 16 [4 | 4] [0 | 0] [8 | 8] 24 24
The spiral starts from the origin (where the [0|0] is placed) with one step in direction North-East (where [1|1] is placed), then one in direction North-West (=> [2|2]), then two towards South-West (=> [3|3] and [4|4]) and two towards South-East (=> [5|5] and [6|6]), then three towards North-East, etc. [We chose the counter-clockwise spiral as usual in mathematics, but one would obviously get the same sequence if the spiral of dominoes and the square spiral numbering the positions were chosen in the opposite, clockwise sense.]
The endpoints of the "straight lines" are labeled with the "quarter-squares" A002620, in particular, rightmost and leftmost dominoes of each "shell" are labeled with the odd resp. even square numbers.
The sequence ends at a(2550) where the knight is stuck at position (x, y) = (28, 4) on the domino labeled m = 964.

Examples

			The knight hops from the left 0 (= the origin) on the right 1, then on the left 2, then on the right 0, then on the left 3, then on the right 2, etc.
The list of these labels would be 0, 1, 2, 0, 3, 2, 8, 3, 4, 5, 1, 4, 6, 7, 9, 11, 12, 14, 11, 10, 24, 22, 7, 8, 10, 9, 23, 6, 5, 15, 13, 12, 27, 26, 48, 23, ...
As explained in comments, the terms a(n) correspond to the (unique) "square spiral numbers" of these locations (cf. A274641 or A174344 (upside down) or A316328).
		

Crossrefs

Cf. A316328, A326924 and A326922 (choose square closest to the origin), A328908 and A328928 (variant using taxicab distance); A328909 and A328929 (variant using sup norm).
Cf. A274641, A174344 (upside down), A268038, A274923 for the square spiral numbering and corresponding (x,y) coordinates.

Programs

  • PARI
    /* function domino([x,y]) gives the label m on the domino at (x,y); it uses the map DOM to store this label with key x + i*y. */
    DOM=Map(); {domino(x)=while(!mapisdefined(DOM, x[1]+I*x[2], &x), my(M=#DOM\2, side=sqrtint(M*4-!!M), pos=sqrtint(M)*I^(side-1)+side\/2%2*I, dir=(1+I)*I^side); for(m=M, M+side\2, mapput(DOM, pos, m); mapput(DOM, pos+1, m); pos+=dir)); x}
    {coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n])}
    {local(U=[]/* used squares */, K=vector(8, i, [(-1)^(i\2)<<(i>4), (-1)^i<<(i<5)])/* knight moves */, pos(x, y)=if(y>=abs(x), 4*y^2-y-x, -x>=abs(y), 4*x^2-x-y, -y>=abs(x), (4*y-3)*y+x, (4*x-3)*x+y), t(x, p=pos(x[1], x[2]))=if(p<=U[1]||setsearch(U, p), oo, [domino(x), p]), nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1][2]); my(A=List(0)/*list of positions*/); for(n=1, oo, U=setunion(U, [A[n]]); while(#U>1&&U[2]==U[1]+1, U=U[^1]); iferr(listput(A, nxt(A[n])), E, break)); print("Index of last term: ", #A-1); A357046(n)=A[n+1];} \\ same code as A326924 except for norml2 => domino
    /* to get the sequence of labels m (cf.example): */
    [domino(coords(A357046(n))) | n <- [0..99]]

A340873 a(n) is the number of iterations of A245471 needed to reach 1 starting from n.

Original entry on oeis.org

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

Author

Rémy Sigrist, Jan 31 2021

Keywords

Comments

This sequence is well defined.
Sketch of proof:
- we focus on odd numbers n > 1,
- if the binary representation of n ends with k 0's and one 1:
in two steps we obtain a number with the same binary length as n
and ending with k-1 0's and one 1,
iterating again will eventually give a number ending with two or more 1's,
- if the binary representation of n ends with k 1's (k > 1):
in k+1 steps we obtain a number with a binary length strictly smaller
than that of n,
- so any odd number > 1 will eventually reach the number 1.

Examples

			For n = 10:
- the trajectory of 10 is 10 -> 5 -> 14 -> 7 -> 8 -> 4 -> 2 -> 1,
- so a(10) = 7.
		

Programs

  • PARI
    a(n) = for (k=0, oo, if (n==1, return (k), n%2, n=bitxor(n, 2*n+1), n=n/2))

Formula

a(2*n) = a(n) + 1.

A337398 Steinhaus' Mega, mod n.

Original entry on oeis.org

0, 0, 1, 0, 1, 4, 4, 0, 4, 6, 3, 4, 9, 4, 1, 0, 1, 4, 6, 16, 4, 14, 3, 16, 6, 22, 22, 4, 16, 16, 8, 0, 25, 18, 11, 4, 7, 6, 22, 16, 10, 4, 16, 36, 31, 26, 25, 16, 39, 6, 1, 48, 24, 22, 36, 32, 25, 16, 20, 16, 12, 8, 4, 0, 61, 58, 33, 52, 13, 46, 12, 40, 32, 44
Offset: 1

Author

Keywords

Comments

This sequence is eventually constant: for all n > Mega, a(n) = Mega.

Programs

  • PARI
    a(n)=my(m=lcm(eulerphi(n),n),t=Mod(256,m),e,last=t); for(i=1,256, e=lift(t); t=t^(e+m); if(t==last, return(e%n)); last=t); lift(t)%n

Formula

a(n) = (2 in a circle) mod n = (256 in a square) mod n = (...((256 in a triangle) in a triangle)... in a triangle) mod n [with 256 triangles], where k in a triangle = k^k, k in a square = k in k triangles, and k in a circle = k in k squares.

A333793 a(n) = A333794(n) - A073934(n).

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 0, 1, 3, 3, 3, 3, 8, 5, 0, 0, 6, 6, 9, 12, 18, 18, 7, 9, 18, 6, 22, 22, 18, 18, 0, 30, 15, 24, 16, 16, 33, 28, 21, 21, 37, 37, 48, 24, 69, 69, 15, 37, 36, 29, 48, 48, 25, 54, 50, 49, 77, 77, 44, 44, 73, 49, 0, 56, 83, 83, 45, 113, 75, 75, 36, 36, 71, 54, 87, 87, 81, 81, 45, 25, 84, 84, 87, 57, 128, 119, 108, 108, 71
Offset: 1

Author

Antti Karttunen, Apr 05 2020

Keywords

Crossrefs

Programs

Formula

a(n) = A333794(n) - A073934(n).
a(p) = a(p-1), for all primes p.
a(A000079(n)) = a(A019434(n)) = 0, for all applicable n.

A308651 a(n+1) = k(a(n), n), where k(m, n) = (m*n) mod (m+n) and with a(1) = 5.

Original entry on oeis.org

5, 5, 3, 3, 5, 5, 8, 11, 12, 3, 4, 14, 12, 6, 4, 3, 10, 8, 14, 2, 18, 27, 6, 22, 22, 33, 32, 38, 8, 10, 20, 8, 16, 38, 68, 11, 20, 56, 60, 63, 48, 10, 4, 31, 14, 40, 34, 59, 50, 74, 104, 34, 48, 19, 4, 43, 32, 44, 2, 57, 27, 63, 31, 73, 14, 41, 31, 19, 74, 101, 59, 29, 68, 29, 86, 10, 72, 31, 20, 95, 75, 147, 146, 210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Author

Stefan Gog, Aug 23 2019

Keywords

Programs

  • Mathematica
    a[1] = 5; a[n_] := a[n] = Mod[a[n - 1] * (n - 1), a[n - 1] + n - 1]; Array[a, 100] (* Amiram Eldar, Aug 29 2019 *)
  • Python
    def k(a,b):
        return (a*b)%(a+b)
    a = [5]
    for n in range(1, 100):
        a.append(k(a[-1], n))
    print(a)

Formula

a(k) = 0 for k >= 85. - Jinyuan Wang, Aug 26 2019
5 is one of the first starting values that produces rather long sequence until collapses to zero.

A323712 Number of the following described shuffles required to return a deck of n cards to its original state. Create two piles by alternating a card from the top of the deck left-right-left-right until the deck is exhausted. Then, placing the left pile on top of the right pile constitutes one shuffle.

Original entry on oeis.org

1, 1, 3, 4, 4, 6, 6, 3, 9, 5, 5, 12, 12, 4, 12, 8, 8, 9, 9, 6, 6, 22, 22, 20, 20, 9, 27, 28, 28, 10, 10, 5, 15, 12, 12, 36, 36, 12, 12, 20, 20, 7, 7, 12, 36, 46, 46, 42, 42, 8, 24, 52, 52, 20, 20, 9, 9, 29, 29, 60, 60, 6, 18, 12, 12, 33, 33, 22, 66, 70, 70, 18
Offset: 1

Author

David Lovler, Jan 24 2019

Keywords

Comments

The card shuffling procedure is the same for even n and odd n.
Here are a few conjectures.
a(n) <= n for all n.
a(p)=a(p-1) and a(p)|p-1 when p is a prime >= 5.
a(n)=a(n-1) and a(n)|n-1 for nonprimes 341=31*11 and 22369621=8191*2731 and probably other pseudoprimes of the form p*((p+2)/3) where p is a Mersenne prime and (p+2)/3 is prime.
n cards are returned to their original state after n shuffles when n=1, 3, 4, 6, 9, 12, 22, 27, 28, 36, 46, 52, 60, 70, 78, 81, ... (A373461) . These values of n are either of the form p-1 where p is an odd prime number or 3^i, i >= 0.
a(c) is relatively small (compared with nearby values) when c is a Catalan number.
a(2n+1)=3*a(2n) or a(2n+1)=a(2n) for all n.

Examples

			For n=4, {a1,a2,a3,a4}-->{a3,a1,a4,a2}-->{a4,a3,a2,a1}-->{a2,a4,a1,a3}-->{a1,a2,a3,a4}, so a(4)=4.
For n=5, {a1,a2,a3,a4,a5}-->{a5,a3,a1,a4,a2}-->{a2,a1,a5,a4,a3}-->{a3,a5,a2,a4,a1}-->{a1,a2,a3,a4,a5}, so a(5)=4.
		

Crossrefs

Cf. A024222, A022998, A163776, A373416 (fixed points).

Programs

  • Maple
    pileShuf := proc(L::list)
        local i,n,shf ;
        shf := [] ;
        n := nops(L) ;
        if type(n,'odd') then
            for i from n to 1 by -2 do
                shf := [op(shf),op(i,L)] ;
            end do:
            for i from n-1 to 2 by -2 do
                shf := [op(shf),op(i,L)] ;
            end do:
        else
            for i from n-1 to 1 by -2 do
                shf := [op(shf),op(i,L)] ;
            end do:
            for i from n to 2 by -2 do
                shf := [op(shf),op(i,L)] ;
            end do:
        end if;
        shf ;
    end proc:
    A323712 := proc(n)
        local L,itr,isord,i;
        L := [seq(i,i=1..n)] ;
        for itr from 1 to n! do
            L := pileShuf(L) ;
            isord := true ;
            for i from 1 to nops(L) do
                if op(i,L) <> i then
                    isord := false ;
                    break ;
                end if;
            end do:
            if isord then
                return itr ;
            end if;
        end do:
        -1 ;
    end proc:
    seq(A323712(n),n=1..50) ; # R. J. Mathar, Aug 02 2024
  • PARI
    perm(n, vn) = {my(va = List(), vb = List()); for (k=1, n, if (k % 2, listput(va, vn[k]), listput(vb, vn[k]));); Vec(concat(Vecrev(va), Vecrev(vb)));}
    a(n) = {my(vn = vector(n,k,k), vs = perm(n, vn), nb = 1); while (vs != vn, vs = perm(n, vs); nb++); nb;} \\ Michel Marcus, Feb 06 2019

Formula

a(2^m) = m if m is odd, a(2^m) = 2m if m is even. - Alois P. Heinz, Feb 15 2019

A321625 The Riordan square of the swinging factorial (A056040), triangle read by rows, T(n, k) for 0 <= k<= n.

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 6, 10, 5, 1, 6, 22, 22, 7, 1, 30, 66, 66, 38, 9, 1, 20, 140, 218, 146, 58, 11, 1, 140, 372, 574, 542, 270, 82, 13, 1, 70, 826, 1680, 1708, 1134, 446, 110, 15, 1, 630, 1930, 4156, 5432, 4126, 2106, 682, 142, 17, 1
Offset: 0

Author

Peter Luschny, Nov 22 2018

Keywords

Examples

			[0] [   1]
[1] [   1,    1]
[2] [   2,    3,    1]
[3] [   6,   10,    5,    1]
[4] [   6,   22,   22,    7,    1]
[5] [  30,   66,   66,   38,    9,    1]
[6] [  20,  140,  218,  146,   58,   11,    1]
[7] [ 140,  372,  574,  542,  270,   82,   13,   1]
[8] [  70,  826, 1680, 1708, 1134,  446,  110,  15,  1]
[9] [ 630, 1930, 4156, 5432, 4126, 2106,  682, 142, 17,  1]
		

Crossrefs

T(n, 0) = A056040 (swinging factorial), A321626 (row sums), A000007 (alternating row sums).
Cf. A321620.

Programs

  • Maple
    # The function RiordanSquare is defined in A321620.
    SwingingFactorial := (1 + x/(1 - 4*x^2))/sqrt(1 - 4*x^2);
    RiordanSquare(SwingingFactorial, 10);
  • Mathematica
    (* The function RiordanSquare is defined in A321620. *)
    SwingingFactorial = (1 + x/(1 - 4*x^2))/Sqrt[1 - 4*x^2];
    RiordanSquare[SwingingFactorial, 10] (* Jean-François Alcover, Jun 15 2019, from Maple *)
  • Sage
    # uses[riordan_square from A321620]
    riordan_square((1 + x/(1 - 4*x^2))/sqrt(1 - 4*x^2), 10)