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 11 results. Next

A309977 Position of n in row n of McGarvey's array; see A007062.

Original entry on oeis.org

1, 1, 6, 4, 5, 11, 2, 22, 13, 15, 30, 4, 23, 11, 12, 58, 43, 45, 68, 28, 97, 37, 8, 64, 35, 95, 66, 10, 105, 21, 82, 54, 55, 155, 196, 126, 171, 93, 142, 184, 27, 235, 16, 290, 157, 65, 124, 18, 81, 131, 72, 288, 239, 243, 304, 36, 375, 209, 144, 276, 211
Offset: 1

Views

Author

Clark Kimberling, Aug 25 2019

Keywords

Examples

			McGarvey's array (from A007062):
   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
   2  1  4  3  6  5  8  7 10  9 12 11 14 13 16 15 18 17 20 19
   4  1  2  5  6  3 10  7  8 11 12  9 16 13 14 17 18 15 22 19
   5  2  1  4  7 10  3  6  9 12 11  8 17 14 13 16 19 22 15 18
   7  4  1  2  5 12  8  6  3 10 13 14 17  8 11 18 15 22 19 16
  12  5  2  1  4  7 14 13 10  3  6  8 22 15 18 11  8 17 24 23
  14  7  4  1  2  5 12 15 22  8  6  3 10 13 20 23 24 17  8 11
  15 12  5  2  1  4  7 14 23 20 13 10  3  6  8 22 25 28 31 18
In row 3, the entry 3 occurs in position 6, so that a(3) = 6.
		

Crossrefs

Cf. A007062.

Programs

  • Mathematica
    s[0] = Range[10000]; s[n_] := Flatten[Map[Reverse, Partition[s[n - 1], n]]];
    Flatten[Table[Position[s[n], n], {n, 1, 500}]]

A362813 Number of numbers that occur more than once in column n of McGarvey's array (A007062).

Original entry on oeis.org

0, 2, 3, 4, 6, 6, 7, 9, 11, 12, 14, 13, 14, 16, 15, 17, 21, 20, 22, 25, 24, 25, 29, 26, 26, 31, 29, 31, 36, 33, 33, 40, 37, 36, 44, 41, 39, 48, 42, 44, 50, 44, 48, 53, 49, 49, 56, 54, 53, 62, 55, 56, 69, 61, 59, 66, 61, 66, 73, 65, 64, 75, 71, 70, 80, 72, 71
Offset: 1

Views

Author

Clark Kimberling, May 04 2023

Keywords

Examples

			Corner of McGarvey's array (from A007062):
   1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
   2  1  4  3  6  5  8  7 10  9 12 11 14 13 16 15 18 17 20 19
   4  1  2  5  6  3 10  7  8 11 12  9 16 13 14 17 18 15 22 19
   5  2  1  4  7 10  3  6  9 12 11  8 17 14 13 16 19 22 15 18
   7  4  1  2  5 12  8  6  3 10 13 14 17  8 11 18 15 22 19 16
  12  5  2  1  4  7 14 13 10  3  6  8 22 15 18 11  8 17 24 23
  14  7  4  1  2  5 12 15 22  8  6  3 10 13 20 23 24 17  8 11
  15 12  5  2  1  4  7 14 23 20 13 10  3  6  8 22 25 28 31 18
(Column 3) = (3,4,2,1,1,2,4,5,7,12,23,...) in which the numbers 1,2,4 occur more than once.
		

Crossrefs

Programs

  • Mathematica
    a = Range[x = 40000]; rows = Table[a = Flatten[Map[Reverse, Partition[a, n]]], {n,
       NestWhile[# + 1 &, 1, (x = # Floor[x/#]) > 0 &] - 1}];
    Flatten[Table[{Length[Select[SortBy[Tally[Map[#[[col]] &, rows]], #[[2]] &], #[[2]] > 1 &]]}, {col, 100}]]  (* Peter J. C. Moses, May 01 2023 *)

A057032 Let P(n) of a sequence s(1), s(2), s(3), ... be obtained by leaving s(1), ..., s(n-1) fixed and forward-cyclically permuting every n consecutive terms thereafter; apply P(2) to 1, 2, 3, ... to get PS(2), then apply P(3) to PS(2) to get PS(3), then apply P(4) to PS(3), etc. The limit of PS(n) as n -> oo is this sequence.

Original entry on oeis.org

1, 3, 4, 7, 6, 10, 8, 16, 15, 21, 12, 22, 14, 27, 28, 36, 18, 33, 20, 43, 35, 39, 24, 53, 34, 45, 46, 50, 30, 66, 32, 78, 52, 57, 55, 81, 38, 63, 59, 88, 42, 86, 44, 96, 87, 75, 48, 119, 64, 111, 76, 101, 54, 103, 79, 144, 83, 93, 60, 141, 62, 99, 113, 173, 91, 136, 68, 139
Offset: 1

Views

Author

Clark Kimberling, Jul 29 2000

Keywords

Comments

Conjecture: a(n) - 1 is prime if and only if a(n) = n + 1. - Mikhail Kurkov, Mar 10 2022

Examples

			PS(2) begins with 1, 3, 2, 5, 4, 7, 6;
PS(3) begins with 1, 3, 4, 2, 5, 9, 7;
PS(4) begins with 1, 3, 4, 7, 2, 5, 9.
		

Crossrefs

Programs

  • MATLAB
    function m = A057032(i) m = PS(i, i); function m = PS(i, n) if i == 1 m = n; elseif n < i m = PS(i - 1, n); else if mod(n, i) == 0 m = PS(i - 1, n + i - 1); else m = PS(i - 1, n - 1); end end
    
  • Mathematica
    PS[i_, n_] := If[i == 1, n, If[n < i, PS[i-1, n], If[Mod[n, i] == 0, PS[i-1, n+i-1], PS[i-1, n-1]]]]; a[n_] := PS[n, n]; Table[a[n], {n, 1, 68}] (* Jean-François Alcover, Oct 20 2011, after MATLAB *)
  • PARI
    a(n) = { my (p=0); forstep (d=n, 1, -1, if (p%d==0, p+=d)); p } \\ Rémy Sigrist, Aug 25 2020

Formula

Conjecture: a(n) = A057064(n+1) - 1 for n > 0. - Mikhail Kurkov, Mar 10 2022

Extensions

More terms from David Wasserman, Apr 22 2002

A057030 Let P(n) of a sequence s(1),s(2),s(3),... be obtained by leaving s(1),...,s(n-1) fixed and reversing every n consecutive terms thereafter; apply P(2) to 1,2,3,... to get PS(2), then apply P(3) to PS(2) to get PS(3), then apply P(4) to PS(3), etc. The limit of PS(n) is A057030.

Original entry on oeis.org

1, 3, 4, 6, 11, 13, 14, 22, 27, 29, 40, 42, 47, 55, 66, 68, 83, 85, 86, 110, 115, 123, 138, 140, 161, 179, 180, 182, 223, 231, 236, 270, 275, 277, 314, 332, 337, 371, 382, 384, 425, 427, 438, 472, 477, 537, 542, 550, 555, 619, 630
Offset: 1

Views

Author

Clark Kimberling, Jul 29 2000

Keywords

Examples

			PS(2) begins with 1,3,2,5,4,7,6;
PS(3) begins with 1,3,4,5,2,9,6;
PS(4) begins with 1,3,4,6,9,2,5.
		

Crossrefs

Programs

  • Mathematica
    a057030=Range[x=3500]; Do[a057030=Flatten[Join[{Take[a057030,n-1]},Map[Reverse,Partition[Drop[a057030,n-1],n]]]],{n,2,NestWhile[#+1&,1,(x=# Floor[x/#])>0&]-1}]; a057030 (* Peter J. C. Moses, Nov 10 2016 *)

Formula

Conjecture: a(n) = A007062(n+1) - 1 for n > 0. - Mikhail Kurkov, Mar 10 2022

A057033 Let P(n) of a sequence s(1),s(2),s(3),... be obtained by leaving s(1),...s(n-1) fixed and reverse-cyclically permuting every n consecutive terms thereafter; apply P(2) to 1,2,3,... to get PS(2), then apply P(3) to PS(2) to get PS(3), then apply P(4) to PS(3), etc. The limit of PS(n) is A057033.

Original entry on oeis.org

1, 3, 5, 2, 9, 11, 6, 15, 17, 10, 21, 12, 4, 27, 29, 18, 19, 35, 22, 39, 41, 8, 45, 28, 30, 51, 36, 34, 57, 59, 14, 43, 65, 42, 69, 71, 24, 53, 77, 7, 81, 60, 54, 87, 64, 58, 67, 95, 26, 99, 101, 37, 105, 107, 70, 111, 84, 32, 88, 93, 78, 47
Offset: 1

Views

Author

Clark Kimberling, Jul 29 2000

Keywords

Examples

			PS(2) begins with 1,3,2,5,4,7,6; PS(3) with 1,3,5,4,2,6,9; PS(4) with 1,3,5,2,6,9,4.
		

Crossrefs

Programs

  • Mathematica
    terms = 62; maxTerms = terms^2; Clear[PS]; PS[n_] := PS[n] = If[n == 1, Range[maxTerms], Join[PS[n-1][[1 ;; n-1]], RotateLeft /@ Partition[ PS[n-1][[n ;; All]], n]] // Flatten]; PS[1]; PS[n = 2]; While[PS[n][[1 ;; terms]] != PS[n-1][[1 ;; terms]], n++]; A057033 = PS[n][[1 ;; terms]] (* Jean-François Alcover, Apr 24 2017 *)

Formula

Conjecture: a(n) = A057063(n+1) - 1 for n > 0. - Mikhail Kurkov, Mar 08 2023

A057063 Let P(n) of a sequence s(1),s(2),s(3),... be obtained by leaving s(1),...,s(n) fixed and reverse-cyclically permuting every n consecutive terms thereafter; apply P(2) to 1,2,3,... to get PS(2), then apply P(3) to PS(2) to get PS(3), then apply P(4) to PS(3), etc. The limit of PS(n) is A057063.

Original entry on oeis.org

1, 2, 4, 6, 3, 10, 12, 7, 16, 18, 11, 22, 13, 5, 28, 30, 19, 20, 36, 23, 40, 42, 9, 46, 29, 31, 52, 37, 35, 58, 60, 15, 44, 66, 43, 70, 72, 25, 54, 78, 8, 82, 61, 55, 88, 65, 59, 68, 96, 27, 100, 102, 38, 106, 108, 71, 112, 85, 33, 89, 94, 79, 48, 126, 83, 130
Offset: 1

Views

Author

Clark Kimberling, Aug 01 2000

Keywords

Comments

It appears that this is a permutation of the integers. - Michel Marcus, Feb 19 2016
The fact that this is a permutation is proved at the MathOverflow link below. Also from that link: a(n)+1 is prime if and only if a(n) = 2*(n-1). - Ilya I. Bogdanov, Feb 15 2022
From Jianing Song, Sep 27 2023: (Start)
Let {b(n)} be the inverse permutation of this sequence, then each number n >= 3 is moved for b(n)-2 times during the process.
Proof: suppose that this number is k, which is well-defined since PS(1), PS(2), ... has a limit. Suppose that PS(i+1)(c_i) = n for each i >= 0, that is, c_i is the index of n after i steps. In the (i+1)-th step, each group of PS(i+1) contains i+2 elements, and every element is moved if and only if it has index at least i+3. We obtain that k = #{i >= 0 : c_i >= i+3}.
Note that if c_i <= i+2 for some i, then from the (i+1)-th step on, each group contains at least i+2 numbers so the first i+2 numbers in the sequence remain fixed, which means that n = PS(i+1)(c_i) = PS(i+2)(c_i) = ... = a(c_i), so c_i = c_{i+1} = ... = b(n). This shows that {i >= 0 : c_i >= i+3} = {0, 1, ..., k-1}, which implies that k is the smallest number such that c_k <= k+2. On one hand, since c_k <= k+2, we have c_k = b(n), so b(n) <= k+2. On the other hand, from the (b(n)-1)-th step on, each group contains at least b(n) numbers so the first b(n) numbers in the sequence remain fixed, which means that PS(b(n)-1)(b(n)) = PS(b(n))(b(n)) = ... = a(b(n)) = n, so c_{b(n)-2} = b(n), and k <= b(n)-2. In conclusion, we have k = b(n)-2.
By the MathOverflow link, we have a(n) <= 2*n-2 for all n, where the equality holds if and only if a(n)+1 is prime. On the other hand, it is hard to get a lower bound for {a(n)}, so it is infeasible to calculate the inverse permutation of this sequence. (End)

Examples

			PS(2) begins with 1,2,4,3,6,5,8;
PS(3) begins with 1,2,4,6,5,3,7;
PS(4) begins with 1,2,4,6,3,7,10.
		

Crossrefs

Programs

  • PARI
    get(v, iv) = if (iv > #v, 0, v[iv]);
    rcp(nbn, nbp, startv, v) = {w = vector(nbn); for (k=1, nbn, if (k % nbp, jv = startv+k, jv = startv+k-nbp); w[k] = get(v, jv);); w;}
    lista(nn) = {v = vector(nn, n, n); print1(v[1], ", ", v[2], ", "); startv = 3; for (n=3, nn, w = rcp(nn-n+1, n-1, startv, v); startv = 2; if (w[1] == 0, break); print1(w[1], ", "); v = w;);} \\ Michel Marcus, Feb 19 2016

Formula

Conjecture: a(n) = A057033(n-1) + 1 for n > 1 with a(1) = 1. - Mikhail Kurkov, Mar 10 2022

A057064 Let P(n) of a sequence s(1),s(2),s(3),... be obtained by leaving s(1),...,s(n) fixed and forward-cyclically permuting every n consecutive terms thereafter; apply P(2) to 1,2,3,... to get PS(2), then apply P(3) to PS(2) to get PS(3), then apply P(4) to PS(3), etc. The limit of PS(n) is A057064.

Original entry on oeis.org

1, 2, 4, 5, 8, 7, 11, 9, 17, 16, 22, 13, 23, 15, 28, 29, 37, 19, 34, 21, 44, 36, 40, 25, 54, 35, 46, 47, 51, 31, 67, 33, 79, 53, 58, 56, 82, 39, 64, 60, 89, 43, 87, 45, 97, 88, 76, 49, 120, 65, 112, 77, 102, 55, 104, 80, 145, 84, 94, 61, 142, 63, 100, 114, 174
Offset: 1

Views

Author

Clark Kimberling, Aug 01 2000

Keywords

Comments

It appears that this is not a permutation of the integers: 3, 6, 10, 12, 14, 18, 20, 24, ... are not terms. - Michel Marcus, Feb 19 2016
Indeed, see the first formula here and the first comment in A069829. - Mikhail Kurkov, Mar 08 2023

Examples

			PS(2) begins with 1,2,4,3,6,5,8; PS(3) with 1,2,4,5,3,6,10; PS(4) with 1,2,4,5,8,3,6.
		

Crossrefs

Programs

  • PARI
    get(v, iv) = if (iv > #v, 0, v[iv]);
    fcp(nbn, nbp, startv, v) = {w = vector(nbn); for (k=1, nbn, j = k % nbp; if (j == 1, jv = startv+k+nbp-2, jv = startv+k-2); w[k] = get(v, jv);); w;}
    lista(nn) = {v = vector(nn, n, n); print1(v[1], ", ", v[2], ", "); startv = 3; for (n=3, nn, w = fcp(nn-n+1, n-1, startv, v); startv = 2; if (w[1] == 0, break); print1(w[1], ", "); v = w;);} \\ Michel Marcus, Feb 19 2016

Formula

a(n) = A057032(n-1) + 1 for n > 1. - Sean A. Irvine, May 19 2022

Extensions

More terms from Michel Marcus, Feb 19 2016

A277679 Start with 1,2,3,4,5,6,.... For n >=1, remove the first n terms and reverse the remaining terms n+1 at a time. Concatenate the terms removed. (See the example.)

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Nov 14 2016

Keywords

Comments

This is a permutation of the natural numbers, with inverse permutation A277680.

Examples

			Remove 1 from A000027, leaving 2,3,4,5,6,7,8,...; reverse these 2 at a time, leaving 3,2,5,4,7,6,9,8,... Remove the first 2 terms and reverse the rest 3 at a time, leaving 7,4,5,8,9,6,13,10,11,14,15,12,... Remove the first 3 terms, and so on. The removed terms, taken in order, are 1,3,2,7,4,5,...
		

Crossrefs

Programs

  • Mathematica
    x = Range[500];
    NestWhile[# + 1 &, 1, (t = 1/2 # (1 + #);
    x = Flatten[{Take[x, t],
    Map[Reverse, Partition[Drop[x, t], # + 1]]}];
    Length[x] > t) &]; x (* A277679 *)
    Take[Ordering[#],Position[Differences[Sort[#]],Except[1]][[2]][[1]]]&[x] (* A277680 *) (* Peter J. C. Moses, Nov 13 2016 *)

A277680 Inverse of the permutation A277679 of the natural numbers.

Original entry on oeis.org

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

Views

Author

Clark Kimberling, Nov 14 2016

Keywords

Comments

This is a permutation of the natural numbers, with inverse permutation A277679.

Crossrefs

Programs

  • Mathematica
    x = Range[500];
    NestWhile[# + 1 &, 1, (t = 1/2 # (1 + #);
    x = Flatten[{Take[x, t],
    Map[Reverse, Partition[Drop[x, t], # + 1]]}];
    Length[x] > t) &]; x (* A277679 *)
    Take[Ordering[#],Position[Differences[Sort[#]],Except[1]][[2]][[1]]]&[x] (* A277680 *) (* Peter J. C. Moses, Nov 13 2016 *)

A366619 Group the natural numbers into blocks of size 2: [1,2], [3,4], ... and reverse the order of the numbers within each block. Then group into blocks of size 3 and reverse the order in each block.

Original entry on oeis.org

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

Views

Author

Wesley Ivan Hurt, Oct 14 2023

Keywords

Comments

Row 3 of the array in A007062.

Examples

			Group natural numbers into blocks of size 2: [1, 2], [3, 4], [5, 6], ...
Reverse the order in each block: [2, 1], [4, 3], [6, 5], ...
Group the remaining sequence into blocks of size 3: [2, 1, 4], [3, 6, 5], ...
Reverse the order in each block to get a(n): 4, 1, 2, 5, 6, 3, ...
		

Crossrefs

Cf. A007062.

Programs

  • Mathematica
    Table[1 + Mod[n, 2] + 2 Floor[3 Floor[(n - 1)/3]/2 + Mod[-n, 3]/2], {n, 100}]

Formula

a(n) = 1 + (n mod 2) + 2*floor(3*floor((n - 1)/3)/2 + (-n mod 3)/2).
G.f.: x*(4 + x - 2*x^2 + 3*x^4)/((1 - x)^2*(1 + x)*(1 + x + x^2)). - Stefano Spezia, Oct 14 2023
a(n+6) = a(n) + 6. - Joerg Arndt, Oct 15 2023
From Wesley Ivan Hurt, Oct 15 2023: (Start)
a(n) = n - (-1)^n + 2*cos(2*(n - 1)*Pi/3) + 2*sin(2*(n - 1)*Pi/3)/sqrt(3).
a(n) = a(n-2) + a(n-3) - a(n-5) for n >= 6. (End)
Showing 1-10 of 11 results. Next