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

A349414 a(n) = A324245(n) - n.

Original entry on oeis.org

0, 1, -2, 2, -1, 3, -5, 4, -2, 5, -8, 6, -3, 7, -11, 8, -4, 9, -14, 10, -5, 11, -17, 12, -6, 13, -20, 14, -7, 15, -23, 16, -8, 17, -26, 18, -9, 19, -29, 20, -10, 21, -32, 22, -11, 23, -35, 24, -12, 25, -38, 26, -13, 27, -41, 28, -14, 29, -44, 30, -15, 31, -47, 32
Offset: 0

Views

Author

Ruud H.G. van Tol, Nov 16 2021

Keywords

Comments

This uses a modified Collatz-Terras map, called f in the Vaillant and Delarue link. Odd k = 2*n+1; a(0) = 0 represents 1 "is done".
From Ruud H.G. van Tol, Dec 09 2021: (Start)
a(n) is given by cases according as r = n mod 4 is 0,1,2,3 so that the sequence can be taken as an array with row m = floor(n/4) and column r,
| 8m + 1 3 5 7 |
| m |r:0 1 2 3 |
+---+--------------+
| 0 | 0 1 -2 2 |
| 1 | -1 3 -5 4 |
| 2 | -2 5 -8 6 |
| 3 | -3 7 -11 8 |
...
All positive integers eventually reach 1 in the Collatz problem iff all nonnegative integers eventually reach 0 with repeated application of this map, i.e., if for all n, the sequence n, n+a(n), n+a(n+a(n)), n+a(n+a(n+a(n))), ... eventually hits 0 (by hitting any a(n) == -n).
Example for m = 1, r = 0: (8m+1) = 9; a(floor(9/2)) = a(4) = -1, which leads to (9 + 2*-1) = 7.
Notice that the "(8m+5) -> (8m+5-1) / 4 = (2k+1)" operation of the values for r == 2, is "shedding bits", similar to what division-by-2 does. Any trailing '101' of the odd is transformed to '1', so it is not performing a Collatz step itself, but it is "escaping the column".
a(n) = A246425(n) if r is in (0,1,3) (A047472). The values for r == 2 are (n' - n + a(n')), with n' derived as (n' = n; n' = floor(n' / 4) while (n' mod 4 == 2)). Example for 8m+5 == 53: n = (53 - 1) / 2 = 26; n' = ((26 -2)/4 -2)/4 = 1; A246425(26) = 1 - 26 + a(1) = -25 + 1 = -24.
(End)

Examples

			a(1) = 1 -> a(1+1) = -2 -> a(1+1-2) = a(0) = 0, which represents 3 -> 5 -> 1.
		

Crossrefs

Programs

  • Mathematica
    Table[(1 - 3 (-1)^n - 4 n (-1)^n + 2 (1 + n) Cos[n*Pi/2])/8, {n, 0, 100}] (* Wesley Ivan Hurt, Nov 16 2021 *)
    LinearRecurrence[{-1,-1,-1,1,1,1,1},{0,1,-2,2,-1,3,-5},64] (* Stefano Spezia, Nov 17 2021 *)
  • PARI
    A324245(n) = if(n%2, (1+3*n)/2, if(!(n%4), 3*(n/4), (n-2)/4));
    A349414(n) = (A324245(n)-n); \\ Antti Karttunen, Dec 09 2021

Formula

a(n) = A324245(n) - n.
a(n) = (n+1)/2 if n is odd,
a(n) = -1*n/4 if n == 0 (mod 4),
a(n) = (n-2)/4 - n if n == 2 (mod 4).
Let r = n mod 4 and m = n div 4.
r=0: a(n) = -1*m = a(n-4)-1
r=1: a(n) = 2*m+1 = a(n-4)+2 = a(n-2)+1
r=2: a(n) = -3*m-2 = a(n-4)-3
r=3: a(n) = 2*m+2 = a(n-4)+2 = a(n-2)+1
The moving sum over 4 elements gives the sequence /1,0,-2,-1/.
From Wesley Ivan Hurt, Nov 16 2021: (Start)
a(n) = (1 - 3*(-1)^n - 4*n*(-1)^n + 2*(1+n)*cos(n*Pi/2))/8.
G.f.: x*(1 - x + x^2 + x^4)/((1-x)*(1 + x + x^2 + x^3)^2). (End)
From Stefano Spezia, Nov 17 2021: (Start)
a(n) = - a(n-1) - a(n-2) - a(n-3) + a(n-4) + a(n-5) + a(n-6) + a(n-7) for n > 6.
E.g.f.: (cos(x) + (2*x - 1)*cosh(x) - x*sin(x) - 2*(x - 1)*sinh(x))/4. (End)
a(n) >= - n. - Ruud H.G. van Tol, Dec 09 2021

A343858 Square array T(m,n), read by ascending antidiagonals. Let f(k) = k/2 if k is even, otherwise ((2*n+1)*k+2*r+1)/2, r is the smallest integer greater than -1, where m = f^j(m) for j > 0 exists and is determined in A345228, T(m,n) is the smallest number reached in the cyclic trajectory of m = f^j(m). f^j(m) means j times recursion into f(m).

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 1, 1, 3, 0, 1, 1, 1, 1, 0, 1, 1, 3, 1, 5, 0, 1, 1, 3, 1, 5, 3, 0, 1, 1, 3, 1, 5, 3, 7, 0, 1, 1, 3, 1, 5, 3, 7, 1, 0, 1, 1, 3, 1, 1, 3, 7, 1, 9, 0, 1, 1, 3, 1, 5, 3, 7, 1, 3, 5, 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 5, 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 1
Offset: 0

Views

Author

Thomas Scheuerle, Jun 14 2021

Keywords

Comments

This sequence, together with A345228, provides information regarding generalized Collatz functions. (Replace 3*k+1 in the standard Collatz function with a more general a*k+b; then a = 1+2*n and b = 1+2*A345228(m,n).) A345228 tells us which m are part of a cyclic orbit but not if these are part of the same cycle. This sequence identifies each distinct cycle with a different number. Example: If A345228(m1,n) = A345228(m2,n) we know m1 and m2 are part of a cycle but not necessarily the same cycle. If T(m1,n) <> T(m2,n) we know m1 and m2 are not in the same cycle.
The value of n appears to have only a small effect in this sequence and in a majority of cases we find T(m,n) = A000265(m) holds true. This is surprising, given how n is involved in the definition.

Examples

			Twelve initial terms of rows 0-10 are listed below:
   n |m->
   0: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 1, 11, ...
   1: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5,  5, ...
   2: 0, 1, 1, 1, 1, 5, 3, 7, 1, 3, 5,  1, ...
   3: 0, 1, 1, 3, 1  5, 3, 7, 1, 9, 5, 11, ...
   4: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, ...
   5: 0, 1, 1, 3, 1, 1, 3, 7, 1, 9, 1, 11, ...
   6: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5,  1, ...
   7: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, ...
   8: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, ...
   9: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, ...
  10: 0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, ...
Example: T(3,4) = 3 -> f(n): k/2; (9*k+21)/2. This is because r = A345228(3,4) = 10 and 2*10+1 = 21.
f(3) = 24, f(24) = 12, f(12) = 6, f(6) = 3, f(3) = 24, ....
The smallest number in this cycle is 3.
		

Crossrefs

Formula

T((1+2*n)*m,n)/T(m,n) = 1+2*n.
T((1+2*(n-b))*m,n)/T(m,n) = 1+2*(n-b). 0 <= b <= n. This formula is only for the majority of cases true if b > 0. For each column m are some rows n where an exception will be seen.
T(m,n) <= A000265(m) (largest odd divisor of m).
T(m,n) = A000265(m) For the majority of all n.

A345228 Square array T(m, n), read by ascending antidiagonals. Let f(k) = k/2 if k is even, otherwise ((2*n+1)*k + 2*T(m, n) + 1)/2, T(m, n) is the smallest integer greater than -1, where m = f^j(m) for j > 0 exists. f^j(m) means the j-th iterate of f(m).

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 3, 0, 0, 2, 2, 0, 2, 3, 1, 0, 2, 3, 0, 1, 2, 10, 0, 2, 1, 3, 0, 0, 1, 7, 3, 2, 1, 3, 4, 0, 7, 0, 4, 2, 17, 1, 3, 5, 4, 0, 6, 7, 1, 1, 4, 10, 3, 0, 4, 5, 0, 5, 6, 22, 0, 7, 7, 24, 4, 1, 2, 5, 0, 4, 5, 19, 7, 2, 4, 17, 3, 4, 2
Offset: 0

Views

Author

Thomas Scheuerle, Jun 11 2021

Keywords

Comments

This sequence is an extension of A344583 ( row T(m, 1) ).
From Thomas Scheuerle, Dec 11 2023: (Start)
It was formerly stated that "T(m, n) >= T(1, n) if m > 0". This was wrong and did not consider an important condition which could lead to exceptions. It is interesting that this wrong statement seems to hold for a vast amount of data.
Known exception: T(1, 90) = 37 but T(27, 90) = 0.
Formerly it was stated that this is a theorem:
"(T( (1 + 2*n)*m, n) - n)/T(m, n) = 1 + 2*n if T(m, n) > 0."
This appears to be true in the majority of cases, but misses some yet unknown conditions. (End)
The reason for the pattern in the row T(1, n) is that in this particular case a cycle is only possible if we eventually reach a power of 2 under iteration. If we look at the case 9x+1 ( Row 4 ) as an example, we can understand this by the binary representation of 9: 1001. If we multiply any number j by 9 it equals a sum of j and a left-shifted version of j. Example j = 5: 1001*101 = 1001 + 100100 = 101101. In the Collatz operation 9x+1, an interrupted sequence of ones starting at the least significant bit is required to get an uninterrupted sequence of zeros by addition of 1. But in the case 9x+1 starting with x = 1 it is not possible to reach any 2^t-1 (pattern of all ones) because of the large gap of zeros in the binary representation of 9 (1001). By each multiplication, we add a shifted copy of 1001... at the left to the bit pattern and thus add gaps that are only slowly filled up with ones by the addition of the constant. To prevent an escape into infinity, in the Collatz process either the factor needs to have a gap of zeros smaller than two zeros in sequence (compare 9 -> row 4 and 15 -> row 7), or the constant we are adding in this process needs to be big enough to fill this gap quickly, e.g., 9x+7.
A surprising mystery are the many equal elements and correlations between different rows. For many values of m, we may observe T(m, n) = T(m, n+k) for some n and k, even if 1+2*n and 1+2*(n+k) are relatively prime.
A343858 identifies each cycle by the smallest number it may reach. This information can be used to check if two entries with the same value in T(m, n) correspond to the same cycle.
We find with growing n more similarity between T(m, n) and A025480(m - 1), the related sequence A343858(m, n) has in the same fashion similarity to A000265(m).
A173732 is the compressed representation of the dynamics of row n = 1 (3x+1). But also A025480(3*n + 1) = A173732(n) and we see now A025480 connected to generalizations of the Collatz function. This suggests a special role for the original 3x+1 version in this set of functions.

Examples

			Twelve initial terms of rows 0-10 are listed below:
   n |m->
   0: 0, 0, 1, 1,  2,  2,  3,  3, 4,  4,  5,  5, ...
   1: 0, 0, 0, 1,  2,  2,  1,  3, 5,  4,  2,  3, ...
   2: 0, 0, 0, 0,  0,  2,  1,  3, 0,  1,  2,  3, ...
   3: 0, 0, 0, 1,  0,  2,  1,  3, 4,  4,  2,  5, ...
   4: 0, 3, 3, 10, 3, 17, 10, 24, 3, 31, 17, 23, ...
   5: 0, 2, 2, 7,  2,  4,  7, 17, 2, 21,  4, 27, ...
   6: 0, 1, 1, 4,  1,  7,  4, 10, 1, 13,  7,  4, ...
   7: 0, 0, 0, 1,  0,  2,  1,  3, 0,  4,  2,  5, ...
   8: 0, 7, 7, 22, 7, 37, 22, 52, 7, 67, 37, 82, ...
   9: 0, 6, 6, 19, 6, 32, 19, 14, 6, 58, 32, 71, ...
  10: 0, 5, 5, 16, 5, 27, 16, 38, 5, 49, 27, 35, ...
We may see this sequence as a sequence of functions:
in m=1: 0 -> f_n1_0(k) =  k/2; (3*k+1)/2.
        1 -> f_n1_1(k) =  k/2; (3*k+3)/2.
        2 -> f_n1_2(k) =  k/2; (3*k+5)/2.
in m=2: 0 -> f_n2_0(k) =  k/2; (5*k+1)/2.
        1 -> f_n2_1(k) =  k/2; (5*k+3)/2.
        2 -> f_n2_2(k) =  k/2; (5*k+5)/2.
T(1, 4) = 3 because: f_n4_3(1) = (9 + 7)/2 = 16, f_n4_3(18) = 16/2 = 8, f_n4_3(8) = 8/2 = 4, f_n4_3(4) = 4/2 = 2, f_n4_3(2) = 2/2 = 1.
This shows that f_n4_3(f_n4_3(f_n4_3(f_n4_3(f_n4_3(1))))) = 1.
T(1, 4) is not < 2 because no such loop which includes 1 exists for f_n4_0, f_n4_1 and f_n4_2.
		

Crossrefs

Programs

  • PARI
    \\ uses magic constant 10^5
    isperiodic(v, z) = for (k=1, #v, if (v[k] == z, return(1)));
    f(tmn, m, n) = if (m%2, ((2*n+1)*m+2*tmn+1)/2, m/2);
    isok(m, n, tmn) = {my(v=[m], y=m); for (i=1, oo, my(z=f(tmn, y, n)); if (z > 10^5, return (0)); if (z == m, return (1)); if (isperiodic(v, z), return(0)); v = concat(v, z); y = z; ); }
    T(m,n) = {my(tmn=0); while (!isok(m, n, tmn), tmn++); tmn; }
    matrix(15,15, n, k, T(k-1, n-1)) \\ Michel Marcus, Jun 17 2021

Formula

T(1, n) = A035327(n) for n > 2.

A350044 Loop starting at 187 in the Collatz-like map {x -> 3x+5 if x is odd, x/2 otherwise}.

Original entry on oeis.org

187, 566, 283, 854, 427, 1286, 643, 1934, 967, 2906, 1453, 4364, 2182, 1091, 3278, 1639, 4922, 2461, 7388, 3694, 1847, 5546, 2773, 8324, 4162, 2081, 6248, 3124, 1562, 781, 2348, 1174, 587, 1766, 883, 2654, 1327, 3986, 1993, 5984, 2992, 1496, 748, 374, 187, 566, 283, 854
Offset: 1

Views

Author

Keywords

Comments

Repeats every forty-four terms starting at 187. Although other loops exist for the "3x+5" map, including 5 -> 20 -> 10 -> 5 and 19 -> 62 -> 31 -> 98 -> 49 -> 152 -> 76 -> 38 -> 19, this loop is much longer and does not appear in the trajectories of as many numbers.
If the Collatz conjecture is false, it will most likely fail because of the existence of a long loop.
a(n) never ends with 0 or 5. a(n+4) - a(n) ends with 0 or 5. - Paul Curtz, Dec 29 2021

Examples

			A181762(187) = 3*(187) + 5 = 566; then A181762(566) = 566/2 = 283.
		

Crossrefs

Programs

  • Mathematica
    a[1] = 187; a[n_] := a[n] = If[OddQ[a[n - 1]], 3*a[n - 1] + 5, a[n - 1]/2]; Array[a, 50] (* Amiram Eldar, Dec 25 2021 *)
  • Python
    N, alst, f = 48, [187], lambda x: x//2 if x%2 == 0 else 3*x + 5
    [alst.append(f(alst[-1])) for _ in range(N)]
    print(alst) # Michael S. Branicky, Dec 28 2021

Formula

a(n) = A181762(a(n-1)) for n > 1, with a(1) = 187.
Showing 1-4 of 4 results.