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.

Previous Showing 11-20 of 21 results. Next

A270814 a(1)=0; thereafter a(2k)=k+a(k), a(2k+1)=6k+4+a(6k+4).

Original entry on oeis.org

0, 1, 46, 3, 31, 49, 281, 7, 330, 36, 248, 55, 106, 288, 679, 15, 197, 339, 500, 46, 127, 259, 610, 67, 633, 119, 101413, 302, 413, 694, 101073, 31, 808, 214, 505, 357, 498, 519, 2305, 66, 101290, 148, 1295, 281, 452, 633, 100932, 91, 757, 658, 1079, 145, 346, 101440, 102261, 330, 1596, 442, 2128
Offset: 1

Views

Author

N. J. A. Sloane, Apr 08 2016

Keywords

Comments

Inspired by A266569.
In other words, a(n) = n/2 + a(n/2) if n even, a(n) = 3n+1+a(3n+1) if n odd.
From Seiichi Manyama, Apr 25 2016: (Start)
This sequence was inspired by the Collatz problem (A006577).
The Collatz rule is as follows: If n is even, divide it by 2, otherwise multiply it by 3 and add 1 (A006370).
For example, starting with n = 3, one gets the sequence 3, 10, 5, 16, 8, 4, 2, 1. So a(3) = 10 + 5 + 16 + 8 + 4 + 2 + 1 = 46. (End) [Comment edited by N. J. A. Sloane, Apr 25 2016]

Crossrefs

Cf. A006370 (Collatz step), A006577 (trajectory length), A033493 (sum including n).

Programs

  • Maple
    A270814 := proc(n)
            local a, traj ;
            a := 0 ;
            traj := n ;
            while traj > 1 do
                    if type(traj, 'even') then
                            traj := traj/2 ;
                    else
                            traj := 3*traj+1 ;
                    end if;
                    a := a+traj ;
            end do:
            return a;
    end proc:
    [seq(A270814(n),n=1..60)];
  • PARI
    a(n) = my(ret=n-1); while((n>>=valuation(n,2)) > 1, ret+=5*n+2; n=3*n+1); ret; \\ Kevin Ryde, Dec 10 2022

Extensions

Typo in definition corrected by Gionata Neri, Apr 08 2016

A049074 Ulam's conjecture (steps to return n to 1 after division by 2 and, if needed, multiplication by 3 with 1 added).

Original entry on oeis.org

8, 3, 49, 7, 36, 55, 288, 15, 339, 46, 259, 67, 119, 302, 694, 31, 214, 357, 519, 66, 148, 281, 633, 91, 658, 145, 101440, 330, 442, 724, 101104, 63, 841, 248, 540, 393, 535, 557, 2344, 106, 101331, 190, 1338, 325, 497, 679, 100979, 139, 806, 708, 1130, 197
Offset: 1

Views

Author

Keywords

Comments

Appeared in School Science and Mathematics in 1982.

Examples

			Beginning at n=1, algorithm produces s+t+a=8.
a(3) = 49 because the trajectory of n=3 is (3, 10, 5, 16, 8, 4, 2, 1) and these numbers sum to 49. - _David Radcliffe_, Aug 28 2025
		

Crossrefs

Almost the same as A033493.
Cf. A049067.

Programs

  • Python
    def a(n):
        if n==1: return 8
        l=[n]
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            l.append(n)
            if n<2: break
        return sum(l)
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 14 2017

A225748 Numbers n for which the sum of the numbers in the Collatz (3x+1) iteration of n is prime.

Original entry on oeis.org

2, 4, 12, 16, 22, 38, 48, 52, 64, 66, 67, 90, 93, 132, 148, 149, 155, 163, 165, 185, 201, 208, 222, 229, 230, 237, 242, 264, 268, 275, 289, 309, 324, 332, 339, 351, 352, 359, 362, 363, 373, 382, 384, 401, 403, 465, 471, 474, 485, 507, 517, 518, 528, 532
Offset: 1

Views

Author

Jayanta Basu, May 14 2013

Keywords

Examples

			12 is a member since 12 + 6 + 3 + 10 + 5 + 16 + 8 + 4 + 2 + 1 = 67 is a prime.
		

Crossrefs

Cf. A033493.

Programs

  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1] &,n,#>1 &]; Select[Range[500],PrimeQ[Total[coll[#]]] &]

A347532 a(n) is the sum of the nonpowers of 2 in the 3x+1 sequence that starts at n.

Original entry on oeis.org

0, 0, 18, 0, 5, 24, 257, 0, 308, 15, 228, 36, 88, 271, 663, 0, 183, 326, 488, 35, 21, 250, 602, 60, 627, 114, 101409, 299, 411, 693, 101073, 0, 810, 217, 509, 362, 504, 526, 2313, 75, 101300, 63, 1307, 294, 466, 648, 100948, 108, 775, 677, 1099, 166, 368, 101463, 102285, 355
Offset: 1

Views

Author

Omar E. Pol, Sep 05 2021

Keywords

Comments

a(n) is the sum of the nonpowers of 2 in the n-th row of A347270.
a(n) = 0 if and only if n is a power of 2.

Examples

			For n = 6 the 3x+1 sequence starting at 6 is 6, 3, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, ... Only the first four terms are nonpowers of 2. The sum of them is 6 + 3 + 10 + 5 = 24, so a(6) = 24.
		

Crossrefs

Cf. A208981 (number of nonpowers of 2).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=2^ilog2(n), 0,
          n+a(`if`(n::odd, 3*n+1, n/2)))
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Sep 05 2021
  • Mathematica
    a[n_] := Plus @@ Select[NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &], # != 2^IntegerExponent[#, 2] &]; Array[a, 50] (* Amiram Eldar, Sep 06 2021 *)

Formula

From Alois P. Heinz, Sep 05 2021: (Start)
a(n) = A033493(n) - 2 * A232503(n) + 1.
a(n) = A033493(n) - 2^(A135282(n)+1) + 1. (End)

A375268 Row sums of A375266.

Original entry on oeis.org

1, 3, 4, 7, 36, 9, 288, 15, 13, 46, 259, 19, 119, 302, 51, 31, 214, 27, 519, 66, 309, 281, 633, 39, 658, 145, 40, 330, 442, 76, 101104, 63, 292, 248, 540, 55, 535, 557, 158, 106, 101331, 344, 1338, 325, 96, 679, 100979, 79, 806, 708, 265, 197, 399, 81, 102316, 386
Offset: 1

Views

Author

Paolo Xausa, Aug 09 2024

Keywords

Crossrefs

Programs

  • Mathematica
    A375265[n_] := Which[Divisible[n, 3], n/3, Divisible[n, 2], n/2, True, 3*n + 1];
    Array[Total[NestWhileList[A375265, #, # > 1 &]] &, 100]

Formula

a(n) = Sum_{k = 1..A375267(n) + 1} A375266(n,k).

A375910 Row sums of A350279.

Original entry on oeis.org

1, 4, 9, 48, 13, 41, 61, 24, 30, 72, 69, 151, 86, 40, 53, 538, 74, 128, 109, 100, 110, 182, 69, 507, 135, 81, 93, 395, 129, 217, 599, 132, 139, 249, 220, 460, 182, 161, 177, 850, 121, 340, 267, 140, 158, 448, 631, 1625, 232, 173, 182, 708, 233, 389, 504, 220, 242, 428
Offset: 1

Views

Author

Paolo Xausa, Sep 02 2024

Keywords

Comments

1

Crossrefs

Programs

  • Mathematica
    FarkasStep[x_] := Which[Divisible[x, 3], x/3, Mod[x, 4] == 3, (3*x + 1)/2, True, (x + 1)/2];
    Array[Total[FixedPointList[FarkasStep, 2*# - 1]] - 1 &, 100]

Formula

a(n) = Sum_{k = 1..A375909(n) + 1} A350279(n,k).

A225866 Numbers n such that the sum of the numbers in the Collatz (3x+1) iteration of n is a perfect square.

Original entry on oeis.org

1, 3, 5, 33, 60, 245, 304, 372, 1265, 1568, 1756, 1799, 1856, 2409, 2532, 2976, 3100, 3281, 3376, 3394, 3813, 5637, 5972, 6147, 6538, 7213, 7299, 7896, 7966, 8371, 10419, 11526, 13411, 13856, 14168, 15024, 15283, 15709, 16506, 16577, 16916, 19212, 19829, 21372
Offset: 1

Views

Author

Michel Lagneau, May 18 2013

Keywords

Examples

			60 is in the sequence because 60 + 30 + 15 + 46 + 23 + 70 + 35 + 106 + 53 + 160 + 80 + 40 + 20 + 10 + 5 + 16 + 8 + 4 + 2 + 1 = 784 = 28^2.
		

Crossrefs

Cf. A033493.

Programs

  • Mathematica
    collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>1&]; Select[Range[22000], IntegerQ[Sqrt[Total[collatz[#]]]]&]

A374843 Number of indices i in [n] such that in the trajectory of i for the Collatz (3x+1) problem the sum and the number of terms are coprime or the trajectory is not finite.

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 12, 13, 14, 14, 14, 14, 14, 15, 16, 17, 17, 18, 18, 19, 20, 21, 22, 22, 23, 23, 23, 24, 25, 26, 27, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 38, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 42, 43, 44, 45
Offset: 1

Views

Author

Alois P. Heinz, Jul 22 2024

Keywords

Comments

Terms in the trajectories for the Collatz (3x+1) problem can be used to approximate the value of Pi. This method was found by Roland Yéléhada (see the links below).

Examples

			a(5) = 4 = 1 + 1 + 1 + 1 + 0, because gcd(1,1) = gcd(2,3) = gcd(8,49) = gcd(3,7) = 1 and gcd(6,36) > 1.
a(1000) = 606 -> sqrt(6*1000/a(1000)) = 3.14658387763... .
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; [n, 1]+
         `if`(n=1, 0, b(`if`(n::even, n/2, 3*n+1)))
        end:
    a:= proc(n) option remember; `if`(n<1, 0,
          a(n-1)+1-signum(igcd(b(n)[])-1))
        end:
    seq(a(n), n=1..68);
  • Mathematica
    b[n_] := b[n] = {n, 1} + If[n == 1, {0, 0}, b[If[EvenQ[n], n/2, 3*n + 1]]];
    a[n_] := a[n] = If[n < 1, 0, a[n - 1] + 1 - Sign[GCD @@ b[n] - 1]];
    Table[a[n], {n, 1, 68}] (* Jean-François Alcover, Sep 04 2024, after Alois P. Heinz *)

Formula

a(n) = a(n-1) + [gcd(A008908(n), A033493(n)) = 1] for n >= 1 with a(0) = 0, where [] is the Iverson bracket.
Limit_{n->oo} sqrt(6*n/a(n)) = Pi = A000796.
Limit_{n->oo} a(n)/n = A059956.
Limit_{n->oo} n/a(n) = A013661.

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).

A274243 Numbers n for which the sum of the odd numbers in the Collatz (3x+1) iteration of n is prime.

Original entry on oeis.org

11, 13, 22, 26, 44, 52, 53, 67, 88, 104, 105, 106, 113, 121, 131, 134, 165, 176, 187, 208, 210, 211, 212, 226, 227, 231, 242, 243, 257, 261, 262, 268, 273, 289, 291, 293, 325, 329, 330, 352, 373, 374, 416, 419, 420, 422, 424, 431, 447, 452, 454, 461, 462, 473
Offset: 1

Views

Author

Michel Lagneau, Jul 01 2016

Keywords

Comments

The corresponding primes are 47, 19, 47, 19, 47, 19, 59, 263, 47, 19, 947, 59, 199, 19777, 419, 263, 20359, 47, 1759, 19, 947, 1291, 59, 199, 569, 23813, 19777, 20173,...

Examples

			11 is in the sequence because the Collatz trajectory of 11 is 11 -> 34 -> 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 and the sum of the odd terms is 11 + 17 + 13 + 5 + 1 = 47 is prime.
		

Crossrefs

Programs

  • Mathematica
    lst={};coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&];a:=Select[coll[n],OddQ[#]&];Do[s=Sum[a[[i]],{i,1,Length[a]}];If[PrimeQ[s],AppendTo[lst,n]],{n,1,500}];lst
Previous Showing 11-20 of 21 results. Next