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: Kevin Ryde

Kevin Ryde's wiki page.

Kevin Ryde has authored 137 sequences. Here are the ten most recent ones:

A386275 First term of the first occurrence of a run of exactly n consecutive terms in A072225.

Original entry on oeis.org

13, 22, 3, 137, 7, 5454, 31076, 8744076, 697642916, 23169509240, 29165083170, 10658896243375
Offset: 1

Author

Kevin Ryde, Jul 25 2025

Keywords

Comments

Exactly n means the run is maximal in the sense that it has no further consecutive term before or after.
Prime Puzzles 798 (see links) considers where runs of consecutive terms occur in A072225 (and similar) and terms here through to n=11 are per row n=3, and extra i with g(3,i)=11, of the minimal i table by Vladimir Chirkov.
a(13) and beyond are > 10658896243375 = a(12).

Examples

			For n=4, the first run of 4 consecutive terms in A072225 begins at its term 137 so that a(4) = 137,
  A072225 = ..., 134, 137, 138, 139, 140, 144
                      \----------------/
                      n=4 consecutive maximal run
The n+2 = 6 primes at prime(137) onwards are 773, 787, 797, 809, 811, 821 and the sum of any consecutive 3 of them is a prime.
		

Crossrefs

Cf. A072225.

Programs

  • C
    /* See links. */

A384688 Runs of t in the range 0 <= t <= k and the same parity as k, for successive k >= 0.

Original entry on oeis.org

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

Author

Kevin Ryde, Jun 07 2025

Keywords

Comments

The corresponding k is A055086(n), or k+1 = A000267(n).
A run is 0, 2, 4, ..., k when k even, or 1, 3, 5, ..., k when k odd, and has length floor(k/2) + 1.
Runs start at quarter squares n = A002620(k+1), with those beginning 0 at oblong numbers n = A002378(i) and those starting 1 at the squares n = (i+1)^2 (for i >= 0 in both cases).
Starts to differ from A025643 at n=109.

Examples

			Runs and their corresponding k = A055086(n) begin,
  n          = 0  1  2    4    6      9
  a(n)       = 0, 1, 0,2, 1,3, 0,2,4, 1,3,5, ...
  A055086(n) = 0, 1, 2,2, 3,3, 4,4,4, 5,5,5, ...
		

Crossrefs

Cf. A002620, A002378 (indices of 0's), A000290 (indices of 1's).

Programs

  • Mathematica
    ClearAll[a] a[n_Integer]:=Module[{s,r},s=Floor[Sqrt[n]]; r=n-s^2; If[rVincenzo Librandi, Jul 06 2025 *)
  • PARI
    a(n) = my(r,s=sqrtint(n,&r)); if(r
    				

Formula

a(n) = 2*r+1 if r < s or a(n) = 2*(r-s) otherwise, where square root and remainder n = s^2 + r being s=A000196(n), r=A053186(n).
a(n) = ceiling(A053186(4*n+1) / 2).
a(n) = A055086(n) - 2*A216607(n+1).
a(n) = 2*A055087(n) + A079813(n+1).

A378847 Smallest starting x which takes n tripling steps to reach the minimum of a cycle in the 3x-1 iteration.

Original entry on oeis.org

1, 3, 15, 13, 9, 37, 25, 33, 45, 57, 145, 97, 65, 87, 159, 165, 225, 273, 391, 261, 647, 465, 741, 529, 353, 471, 921, 837, 865, 577, 385, 257, 343, 229, 153, 407, 543, 721, 481, 321, 855, 1141, 761, 1015, 677, 903, 1209, 1605, 2149, 1433, 1911, 2529, 3397, 2265
Offset: 0

Author

Kevin Ryde, Dec 15 2024

Keywords

Comments

Each step is x -> 3x-1 if x odd, or x -> x/2 if x even (A001281) and here only the tripling steps 3x-1 are counted.
The number of tripling steps is A378833(x) so that a(n) = x is the smallest x for which A378833(x) = n.
All terms are odd since any even x takes a first step to x/2 which is a smaller start for the same number of tripling steps.
a(n) >= L(n) = (2*a(n-1) + 1)/3 is a lower bound since a(n) = x must at least have a first step 3x-1 and halve to (3x-1)/2, then n-1 further tripling steps, so (3x-1)/2 >= a(n-1).
Equality a(n) = L(n) occurs iff L(n) is an integer and not a cycle minimum.
A large upper bound for n>=1, showing a(n) always exists, is a(n) <= U(n) = (4^(3^n) - 1)*2^n/3^n + 1, since U(n) is a candidate for a(n) by taking n steps of (3x-1)/2 to reach 4^(3^n) which is a power of 2.
Tighter upper bounds on a(n) can be found by taking predecessor steps back from a(n-c) seeking c tripling steps to reach a(n-c) if that's possible (which for instance it's not if a(n-c) == 0 (mod 3)).
Such predecessors are candidates for a(n), but the actual a(n) might have a trajectory which does not go through any previous a(n-c).

Examples

			For n=4, a(4) = 9 has 4 tripling steps on its way to 5 which is the minimum of a cycle:
  9 -> 26 -> 13 -> 38 -> 19 -> 56 -> 28 -> 14 -> 7 -> 20 -> 10 -> 5
    ^            ^           ^                      ^
This a(4) = 9 is an example where a(n) is at its lower bound L(n), in this case a(3) = 13 has L(4) = (2*a(3)+1)/3 = 9 which is an integer and not a cycle minimum.
		

Crossrefs

Cf. A001281 (step), A378833 (number of triplings).
Cf. A378845 (with all steps), A378846 (with halving steps).

Programs

  • C
    /* See links. */

A378846 Smallest starting x which takes n halving steps to reach the minimum of a cycle in the 3x-1 iteration.

Original entry on oeis.org

1, 2, 4, 3, 6, 11, 13, 9, 18, 35, 25, 47, 33, 63, 45, 81, 95, 117, 127, 85, 57, 113, 133, 89, 97, 65, 129, 87, 173, 225, 231, 293, 309, 377, 261, 273, 545, 671, 465, 485, 597, 647, 741, 529, 353, 705, 471, 941, 1029, 1241, 837, 577, 385, 257, 513, 343, 229, 153
Offset: 0

Author

Kevin Ryde, Dec 15 2024

Keywords

Comments

Each step is x -> 3x-1 if x odd, or x -> x/2 if x even (A001281) and here only the halving steps x/2 are counted.
The number of halving steps is A377524(x) so that a(n) = x is the smallest x for which A377524(x) = n.
a(n) <= 2*a(n-1) is an upper bound since x = 2*a(n-1) is a candidate for a(n) by first step x -> x/2.
All even terms are a(n) = 2*a(n-1), since any smaller even a(n) would imply a smaller a(n-1) by first step x -> x/2.
No term is of the form y = 6*k + 2, apart from a(1)=2, since odd x = 2*k+1 takes a tripling step to 3*x-1 = y and x is a smaller start with the same number of halvings as y.

Crossrefs

Cf. A001281 (step), A377524 (number of halving steps).
Cf. A378845 (with all steps), A378847 (with tripling steps).

Programs

  • C
    /* See links. */

A378845 Smallest starting x which takes n steps to reach the minimum of a cycle in the 3x-1 iteration.

Original entry on oeis.org

1, 2, 4, 7, 3, 6, 11, 19, 21, 13, 26, 9, 18, 35, 37, 73, 25, 49, 98, 33, 66, 131, 45, 90, 175, 127, 117, 85, 149, 57, 113, 199, 209, 133, 265, 89, 177, 65, 119, 237, 87, 159, 165, 329, 231, 225, 439, 309, 293, 585, 377, 391, 273, 261, 521, 1042, 671, 695, 485
Offset: 0

Author

Kevin Ryde, Dec 09 2024

Keywords

Comments

Each step is x -> 3x-1 if x odd, or x -> x/2 if x even (A001281).
The number of steps is A135730(x) so that a(n) = x is the smallest x for which A135730(x) = n.
a(n) <= 2*a(n-1) since x = 2*a(n-1) is a candidate for a(n) by first step x -> x/2.
Even terms are always a(n) = 2*a(n-1) since any smaller even a(n) would imply a smaller a(n-1) after first step x -> x/2.
No term is of the form 12*k+4, since its first step to 6*k+2 is also where the first step from 2*k+1 goes and the latter is a smaller start.
a(n) >= (a(n-1) + 1)/3 is a lower bound since a(n) = x must at least have a first step 3x-1 which reaches somewhere with n-1 further steps, so 3x-1 >= a(n-1).
Equality a(n) = (a(n-1) + 1)/3 = x occurs iff that x is an odd integer and not a cycle minimum, so its first step is to 3x-1 = a(n-1) (as for example at n=11).

Crossrefs

Cf. A001281 (step), A135730 (number of steps).
Cf. A378846 (with halving steps), A378847 (with tripling steps).
Cf. A033491 (in 3x+1).

Programs

  • C
    /* See links. */

A378834 Number of ways to reverse a permutation of n elements by the minimum number of steps of rotate left or right 1 place (L,R), or exchange first two elements (E).

Original entry on oeis.org

1, 3, 2, 2, 2, 6, 6, 32, 32, 240, 240, 2304, 2304
Offset: 1

Author

Kevin Ryde, Dec 09 2024

Keywords

Comments

The minimum number of steps is A186752(n).
For n=2, steps L,R,E all have the same effect but each is taken as a separate way so that a(2) = 3.
For 4 <= n <= 13, a(n) = (h+2)*2^h*h! where h = floor((n-4)/2).

Examples

			For n=1, permutation {1} is already its own reversal so has a(1) = 1 way of no steps (A186752(1) = 0).
For n=5, the a(5) = 2 ways to reverse {1,2,3,4,5} by A186752(5) = 8 steps are
  E, L, L, E, L, E, R, E
  E, L, E, R, E, R, R, E
Notice these are inverses: reverse the order and flip L<->R in one makes the other.
		

Crossrefs

Cf. A186752 (number of steps).
Cf. A061545 (ways for LE).

A378881 Irregular triangle listing permutations of {1,...,m} which are at maximum distance from the identity permutation under steps rotate left (L) or exchange first two elements (E).

Original entry on oeis.org

1, 2, 1, 1, 3, 2, 3, 1, 2, 3, 2, 1, 2, 1, 4, 3, 2, 3, 1, 4, 2, 4, 3, 1, 1, 2, 5, 3, 4, 2, 1, 5, 3, 4, 3, 1, 6, 5, 4, 2, 2, 1, 7, 6, 3, 5, 4, 2, 1, 7, 6, 4, 3, 5, 3, 1, 8, 7, 6, 5, 4, 2, 2, 1, 9, 8, 7, 3, 6, 5, 4, 2, 1, 9, 8, 7, 5, 4, 3, 6, 3, 1, 10, 9, 8, 7, 6, 5, 4, 2
Offset: 1

Author

Kevin Ryde, Dec 09 2024

Keywords

Comments

Permutations are listed for successive m >= 1 and in lexicographic order for multiple permutations in each m.
The maximum distance is A039745(m) and there may be multiple permutations at that distance.
The number of permutations at the maximum distance is A186144(m). - Pontus von Brömssen, Dec 12 2024

Examples

			Triangle begins:
       k=1  2  3  4  5
  n=1:   1
  n=2:   2, 1
  n=3:   1, 3, 2
  n=4:   3, 1, 2
  n=5:   3, 2, 1
  n=6:   2, 1, 4, 3
  n=7:   2, 3, 1, 4
  n=8:   2, 4, 3, 1
  n=9:   1, 2, 5, 3, 4
  n=10:  2, 1, 5, 3, 4
For m=10 there is a single permutation at distance A039745(10) = 58, being row n=17,
  3,1, 10,9,8,7,6,5,4, 2
This shows a pattern seen in even m ranging 6 <= m <= 12 where elements 2 and 3 are exchanged in what would otherwise be decreasing elements (with wrap-around).
For m=11 there are two permutations at distance A039745(11) = 71, being rows n=18 and n=19,
  2,1, 11,10,9,8, 3,7,6,5,4
  2,1, 11,10,9,8, 6,5,4,3,7
                  \-------/
These show a pattern seen in odd m ranging 7 <= m <= 13 where the final (m-1)/2 elements are rotated left and right from what would otherwise be decreasing elements (with wrap-around).
		

Crossrefs

A378833 Number of tripling steps in the 3x-1 trajectory from n to the minimum of its cycle, or -1 if n never reaches a cycle.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 1, 0, 4, 0, 1, 1, 3, 1, 2, 0, 0, 4, 2, 0, 3, 1, 1, 1, 6, 3, 1, 1, 2, 2, 2, 0, 7, 0, 4, 4, 5, 2, 3, 0, 3, 3, 1, 1, 8, 1, 5, 1, 6, 6, 3, 3, 4, 1, 4, 1, 9, 2, 2, 2, 2, 2, 6, 0, 12, 7, 7, 0, 5, 4, 5, 4, 5, 5, 2, 2, 3, 3, 3, 0, 7, 3, 3, 3, 8, 1, 13
Offset: 1

Author

Kevin Ryde, Dec 08 2024

Keywords

Comments

The 3x-1 iteration is x -> 3x-1 if x odd, or x -> x/2 if x even (A001281).
The cycle minima presently known are 1, 5 and 17.
a(n) = 0 iff n = m*2^k where m is one of the cycle minima.

Crossrefs

Cf. A001281 (step), A135730 (total steps), A377524 (halving steps).

Formula

a(n) = A135730(n) - A377524(n), if a(n) != -1.

A378375 Number of ways to go from n to 1 by the minimum number of steps of x -> 3x-1 if x odd, x -> 3x-1 or x/2 if x even.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 22, 2, 2, 2, 3, 1, 1, 1, 15, 1, 2, 2, 1, 1, 3, 1, 15, 34, 2, 4, 8, 2, 1, 2, 2, 7, 1, 1, 2, 2, 3, 1, 11, 22, 2, 2, 1, 2, 8, 2, 5, 1, 1, 1, 1, 3, 4, 1, 10, 30, 2, 1, 1, 2, 1, 4, 6, 15, 2, 2, 1, 1, 1, 2, 1, 3, 6, 11
Offset: 1

Author

Kevin Ryde, Nov 25 2024

Keywords

Comments

The minimum number of steps is A261870(x).
For odd n > 1, a(n) = a(3*n-1) since the first step must be n -> 3n-1.
For even n, a(n) = a(3*n-1) or a(n/2) or their sum a(3*n-1) + a(n/2), depending on which one or both of 3n-1 or n/2 are the minimum steps.
a(2^k) = 1 since the minimum number of steps for 2^k is k steps of x/2..
a(n) = 0 if there's no way to go from n to 1 (if any such n exists).

Examples

			For n=20, the a(20) = 2 ways to go from 20 to 1, by the minimum A261870(20) = 12 steps, are
  20, 59, 176, 88, 44,  22, 11, 32, 16, 8, 4, 2, 1
  20, 10,  29, 86, 43, 128, 64, 32, 16, 8, 4, 2, 1
This is a case where n is even and 3n-1 and n/2 are the same number of steps so that a(n) = a(3*n-1) + a(n/2).
For n=7, the a(7) = 2 ways are by the sole possible step 7 -> 20 since 7 is odd, followed by each of the a(20) = 2 ways shown above.
		

Crossrefs

Cf. A261870.

Programs

  • C
    /* See links. */

A378376 Smallest starting x which requires n steps to reach 1 under the map x -> 3x-1 if x odd, x -> 3x-1 or x/2 if x even.

Original entry on oeis.org

1, 2, 4, 8, 3, 6, 11, 22, 43, 15, 29, 10, 20, 7, 14, 5, 9, 18, 35, 13, 23, 46, 91, 31, 61, 21, 41, 81, 161, 55, 109, 37, 73, 25, 49, 17, 33, 65, 129, 257, 87, 173, 341, 117, 225, 455, 153, 305, 607, 209, 405, 809, 273, 543, 185, 369, 721, 1433, 481, 961, 321
Offset: 0

Author

Kevin Ryde, Nov 25 2024

Keywords

Comments

The number of steps required is A261870(x) so that a(n) = x is the smallest x where A261870(x) = n.
a(n) <= 2^n is a simple upper bound, since x = 2^n requires n steps to reach 1.
But 2*a(n-1) = x is not an upper bound on a(n), since although x/2 = a(n-1) requires a further n-1 steps, x can also step to 3x-1 and doing so might be fewer steps (which it is for example at n=45).
a(n) >= (a(n-1)+1)/3 is a lower bound since a(n) = x must have 3x-1 >= a(n-1) so as to reach somewhere requiring n-1 further steps.
If a(n-1) == 2 (mod 6), then equality a(n) = (a(n-1)+1)/3 holds since then a(n) is odd and its first step must be 3x-1 (as for example at n=4).

Examples

			For n=4, a(4) = 3 is the smallest x requiring n=4 steps to reach 1 (by trajectory 3 -> 8 -> 4 -> 2 -> 1).
a(4) = 3 is also an example where a(n) is its lower bound (a(n-1)+1)/3 (with a(3) = 8).
		

Crossrefs

Cf. A261870.

Programs

  • C
    /* See links. */