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.

A386437 Alternating sum of the numbers in the trajectory of n for the 3x+1 problem.

Original entry on oeis.org

1, 1, -13, 3, -6, 19, -24, 5, 19, 16, -9, -7, -23, 38, -212, 11, 14, -1, -85, 4, -22, 31, -181, 31, 72, 49, -21488, -10, -46, 242, 21412, 21, -89, 20, -134, 37, -9, 123, -104, 36, -21433, 64, -104, 13, -43, 227, 21475, 17, -16, -22, -246, 3, -63, 21542, 21040, 66, 75, 104
Offset: 1

Views

Author

Luca Santarsiero, Jul 21 2025

Keywords

Comments

Conjecture: Let P(n) be the set of distinct positive prime numbers that appear in the first n terms of the sequence. Let Q(n) be the subset of those primes that appear with frequency >= 2. Then, as n -> oo, the ratio |Q(n)|/|P(n)| tends to 11/100. Verified for n <= 5 * 10^7.
a(n) < A033493(n), for all n > 1.
Conjecture: Let S(n) be the set of positive prime numbers that appear in the first n terms of the sequence. Then, as n -> oo, the ratio |S(n)|/n tends to 0. Verified for n <= 10^6.

Examples

			a(3) = 3 - 10 + 5 - 16 + 8 - 4 + 2 - 1 = -13.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; n-`if`(n=1, 0,
          a(`if`(n::even, n/2, 3*n+1)))
        end:
    seq(a(n), n=1..58);  # Alois P. Heinz, Jul 24 2025
  • Mathematica
    a[n_] := Module[{x = n, seq = {n}},While[x != 1, x = If[EvenQ[x], x/2, 3 x + 1]; AppendTo[seq, x]];Total[seq*Table[(-1)^i, {i, 0, Length[seq] - 1}]]]Table[a[n], {n, 1, 60}]
  • PARI
    a(n) = my(s=n, m=n, k=-1); while (m != 1, if (m%2, m=3*m+1, m=m/2); s+=k*m; k=-k); s; \\ Michel Marcus, Jul 25 2025

Formula

a(n) = Sum_{k=1..A006577(n)} A070165(n,k) * (-1)^(k+1).