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 41-50 of 121 results. Next

A225761 Numerators of the sums of reciprocals of the Collatz (3x+1) sequence beginning with n and stopping at 1.

Original entry on oeis.org

1, 3, 617, 7, 171, 219, 766329, 15, 1061683, 179, 102151, 677, 497, 785777, 10380059, 31, 8861, 360377, 60226515, 183, 2731, 103919, 3339321, 229, 1548244271, 505, 129481899470258402665619129356105706380861444925035330406812603986229803685477, 113643
Offset: 1

Views

Author

Nico Brown, May 14 2013

Keywords

Comments

If the sum of the reciprocals of a Collatz sequence is bounded, there are no cycles other than 4,2,1.
a(n) = numerator of sum (1/A070165(n,k): k = 1..A006577(n)). - Reinhard Zumkeller, May 16 2013

Examples

			For n=9 the Collatz sequence is {9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 4, 2, 1}.  So the sum of the reciprocals is 1/9 + 1/28 + 1/14 + 1/7 + 1/22 + 1/11 + ... + 1/4 + 1/2 + 1/1 = 1061683/350064, whose numerator is 1061683.
		

Crossrefs

Cf. A087226, A225784 (denominators).
Cf. A225843.

Programs

  • Haskell
    import Data.Ratio (numerator)
    a225761 = numerator . sum . map (recip . fromIntegral) . a070165_row
    -- Reinhard Zumkeller, May 16 2013
  • Mathematica
    Table[Numerator[Total[1/Collatz[n]]], {n, 40}] (* T. D. Noe, May 15 2013 *)

Extensions

Extended by T. D. Noe, May 15 2013

A235801 Length of n-th horizontal line segment in a diagram of a two-dimensional version of the 3x+1 (or Collatz) problem.

Original entry on oeis.org

0, 1, 2, 3, 7, 5, 6, 7, 8, 9, 17, 11, 12, 13, 14, 15, 27, 17, 18, 19, 20, 21, 37, 23, 24, 25, 26, 27, 47, 29, 30, 31, 32, 33, 57, 35, 36, 37, 38, 39, 67, 41, 42, 43, 44, 45, 77, 47, 48, 49, 50, 51, 87, 53, 54, 55, 56, 57, 97, 59, 60, 61, 62, 63, 107, 65, 66
Offset: 0

Views

Author

Omar E. Pol, Jan 15 2014

Keywords

Comments

In the diagram every cycle is represented by a directed graph.
After (3x + 1) the next step is (3y + 1).
After (x/2) the next step is (y/2).
A235800(n) gives the length of n-th vertical line segment, from left to right, in the same diagram.

Examples

			The first part of the diagram in the first quadrant:
. . . . . . . . . . . . . . . . . . . . . . . .
.              _ _|_ _|_ _|_ _|_ _|_ _|_ _|_ _.
.             |   |   |   |   |   |   |   |_|_.
.             |   |   |   |   |   |   |  _ _|_.
.             |   |   |   |   |   |   |_|_ _|_.
.             |   |   |   |   |   |  _ _|_ _|_.
.             |   |   |   |   |   |_|_ _|_ _|_.
.          _ _|_ _|_ _|_ _|_ _|_ _ _|_ _|_ _|_.
.         |   |   |   |   |   |_|_ _|_ _|_ _|_.
.         |   |   |   |   |  _ _|_ _|_ _|_ _|_.
.         |   |   |   |   |_|_ _|_ _|_ _|_ _|_.
.         |   |   |   |  _ _|_ _|_ _|_ _|_ _|_.
.         |   |   |   |_|_ _|_ _|_ _|_ _|_ _| . 11
.      _ _|_ _|_ _|_ _ _|_ _|_ _|_ _|_ _|     . 17
.     |   |   |   |_|_ _|_ _|_ _|_ _|         .  9
.     |   |   |  _ _|_ _|_ _|_ _|             .  8
.     |   |   |_|_ _|_ _|_ _|                 .  7
.     |   |  _ _|_ _|_ _|                     .  6
.     |   |_|_ _|_ _|                         .  5
.  _ _|_ _ _|_ _|                             .  7
. |   |_|_ _|                                 .  3
. |  _ _|                                     .  2
. |_|                                         .  1
. . . . . . . . . . . . . . . . . . . . . . . .  0
.                                              a(n)
.
For an explanation of this diagram as the skeleton of a piping model see A235800. - _Omar E. Pol_, Dec 30 2021
		

Crossrefs

Cf. A347270 (all 3x+1 sequences).
Companion of A235800.

Programs

  • Python
    from _future_ import division
    A235801_list = [n if n % 6 != 4 else 10*(n//6)+7 for n in range(10**4)] # Chai Wah Wu, Sep 26 2016

Formula

a(n) = 10*k - 3, if n is of the form (6*k-2), k>=1, otherwise a(n) = n.
From Chai Wah Wu, Sep 26 2016: (Start)
a(n) = 2*a(n-6) - a(n-12) for n > 11.
G.f.: x*(x^2 + 1)*(x^3 + 2*x^2 + 1)*(x^5 + x^4 + 2*x + 1)/(x^12 - 2*x^6 + 1). (End)

A258145 Row lengths of the irregular array in A256598.

Original entry on oeis.org

1, 3, 2, 6, 7, 5, 3, 6, 4, 7, 2, 5, 8, 42, 6, 40, 9, 4, 7, 12, 41, 10, 5, 39, 8, 8, 3, 42, 11, 11, 6, 40, 9, 9, 4, 38, 43, 4, 7, 12, 7, 41, 2, 10, 10, 34, 5, 39, 44, 8, 8, 32, 13, 37, 42, 25, 3, 11, 6, 11, 35
Offset: 0

Views

Author

Wolfdieter Lang, May 27 2015

Keywords

Comments

a(n) is the number of odd numbers in row A070165(2*n+1) and also in row A070168(2*n+1), for n >= 0 (if it turns out that a row 2*n+1 has infinite row length one puts a(n) = 0).

Crossrefs

A258772 Number of fixed points in the Collatz (3x+1) trajectory of n.

Original entry on oeis.org

1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
Offset: 1

Views

Author

Derek Orr, Jun 09 2015

Keywords

Comments

This sequence uses the definition in A006370: if n is odd, n -> 3n+1 and if n is even, n -> n/2.
The number 3 appears first at a(187561). Do all nonnegative numbers appear? See A258821.

Examples

			For n = 5, the trajectory is T(5) = [5, 16, 8, 4, 2, 1]. Since the fourth term in this sequence is 4, this is a fixed point. Since there is only one fixed point, a(5) = 1.
For n = 6, the trajectory is T(6) = [6, 3, 10, 5, 16, 8, 4, 2, 1]. Here, the k-th term in this trajectory does not equal k for any possible k. So a(6) = 0.
		

Crossrefs

Programs

  • Mathematica
    A258772[n_]:=Count[MapIndexed[{#1}==#2&,NestWhileList[If[OddQ[#],3#+1,#/2]&,n,#>1&]],True];Array[A258772,100] (* Paolo Xausa, Nov 06 2023 *)
  • PARI
    Tvect(n)=v=[n];while(n!=1,if(n%2,k=(3*n+1);v=concat(v,k);n=k);if(!(n%2),k=n/2;v=concat(v,k);n=k));v
    for(n=1,200,d=Tvect(n);c=0;for(i=1,#d,if(d[i]==i,c++));print1(c,", "))

A263716 Irregular triangle read by rows: numbers in the Collatz conjecture in the order of their first appearance.

Original entry on oeis.org

1, 2, 3, 10, 5, 16, 8, 4, 6, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 9, 28, 14, 12, 15, 46, 23, 70, 35, 106, 53, 160, 80, 18, 19, 58, 29, 88, 44, 21, 64, 32, 24, 25, 76, 38, 27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182
Offset: 0

Views

Author

Daniel Suteu, Oct 24 2015

Keywords

Comments

This is the irregular triangle read by rows giving trajectory of n in the Collatz problem, flattened and with all the repeated terms deleted.
This sequence goes to infinity as n gets larger. On the Collatz conjecture this sequence is a permutation of the positive integers. [Corrected by Charles R Greathouse IV, Jul 29 2016]

Examples

			Triangle begins:
1;
2;
3, 10, 5, 16, 8, 4;
...
The Collatz trajectories for the first five positive integers are {1}, {2, 1}, {3, 10, 5, 16, 8, 4, 2, 1}, {4, 2, 1}, {5, 16, 8, 4, 2, 1}.
From {2, 1} we delete 1 because it has already occurred. From {3, 10, 5, ..., 4, 2, 1} we delete {2, 1} because both numbers have already occurred. We completely get rid of {4, 2, 1} because it has already occurred as the tail end of {3, 10, 5, ...}, and we also completely get rid of {5, 16, 8, ...} for the same reason.
This leaves us with {1}, {2}, {3, 10, 5, 16, 8, 4}, thus accounting for the first eight terms of this sequence.
		

Crossrefs

Cf. A006577, A070165, A222118 (row lengths).
Cf. A347265 (essentially the same).

Programs

  • Mathematica
    collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; DeleteDuplicates[Flatten[Table[collatz[n], {n, 20}]]] (* Alonso del Arte, Oct 24 2015 *)
  • Sidef
    func collatz(n) is cached {  # automatically memoized function
        say n;                   # prints the first unseen numbers
        n.is_one ? 0
                 : (n.is_even ? collatz(n/2)
                              : collatz(3*n + 1));
    }
    range(1, Math.inf).each { |i| collatz(i) }

Formula

row(n) = {
if seen[n]: stop
else: write(n) and do:
| n is one: stop
| n is odd: n <- 3*n+1
| n is even: n <- n/2
}

A280408 Irregular triangle read by rows listing the prime numbers that appear from the trajectory of n in Collatz Problem.

Original entry on oeis.org

2, 2, 3, 5, 2, 2, 5, 2, 3, 5, 2, 7, 11, 17, 13, 5, 2, 2, 7, 11, 17, 13, 5, 2, 5, 2, 11, 17, 13, 5, 2, 3, 5, 2, 13, 5, 2, 7, 11, 17, 13, 5, 2, 23, 53, 5, 2, 2, 17, 13, 5, 2, 7, 11, 17, 13, 5, 2, 19, 29, 11, 17, 13, 5, 2, 5, 2, 2, 11, 17, 13, 5, 2, 23, 53, 5, 2, 3, 5, 2, 19, 29, 11, 17, 13, 5, 2
Offset: 1

Views

Author

Matthew Campbell, Jan 02 2017

Keywords

Examples

			The irregular array a(n,k) starts:
n\k   1   2   3   4   5   6
...
1:    2
2:    2
3:    3   5   2
4:    2
5:    5   2
6:    3   5   2
7:    7  11  17  13   5   2
8:    2
9:    7  11  17  13   5   2
10:   5  2
11:  11  17  13   5   2
12:   3   5   2
13:  13   5   2
14:   7  11  17  13   5   2
15:  23  53   5   2
		

Crossrefs

Programs

  • Mathematica
    Table[Select[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, # > 1 &], PrimeQ], {n, 2, 30}] // Flatten (* Michael De Vlieger, Jan 02 2017 *)
  • Python
    from sympy import isprime
    def a(n):
        if n==1: return [2]
        l=[n, ]
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            l+=[n, ]
            if n<2: break
        return list(filter(lambda i: isprime(i), l))
    for n in range(1, 21): print(a(n)) # Indranil Ghosh, Apr 14 2017

A304030 a(n) is the number of steps at which the Collatz ('3x+1') trajectory of n crosses its initial value, or -1 if the number of crossings is infinite.

Original entry on oeis.org

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

Views

Author

Jon E. Schoenfield, May 04 2018

Keywords

Comments

Some treatments of the Collatz conjecture view trajectories as starting to cycle when they reach 1, continuing with 4, 2, 1, 4, 2, 1, ..., while others view trajectories as terminating as soon as 1 is reached; this sequence treats trajectories as terminating at 1.
If the Collatz conjecture is true, then for n > 1, a(n) == n (mod 2).
If there exists any number n whose Collatz trajectory enters a cycle that includes values above and below n, then the number of crossings would be infinite. If the Collatz conjecture is true, then there exists no such value of n.
If a(k) = 0, then a(2^j * k) = 0, for j>0. Therefore the primitives are 1, 20, 24, 52, 56, 68, 72, 84, 88, 100, 116, ..., . - Robert G. Wilson v, May 19 2018

Examples

			The Collatz trajectory of 6 crosses its initial value (6) a total of 4 times, so a(6) = 4:
.
                           16
                           / \
                          /   \
              10         /     \
              / \       /       \
             /   \     /         8
  6---------*-----*---*-----------*--------
   \       /       \ /             \
    \     /         5               \
     \   /                           \
      \ /                             4
       3                               \
                                        ...
(Each "*" represents a crossing.)
		

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[ If[ OddQ@#, 3# +1, #/2] &, n, # > 1 &]; f[n_] := Block[{x = Length[ SplitBy[ Collatz@ n, # < n +1 &]] - 1}, If[ OddQ@ n && n > 1, x - 1, x]]; Array[f, 100] (* Robert G. Wilson v, May 05 2018 *)
  • Python
    def A304030(n):
        prevc = c = n
        h = 0
        while c > 1:
            if c % 2:
                c = 3*c+1
                if prevc < n and c > n: h += 1
            else:
                c //= 2
                if prevc > n and c < n: h += 1
            prevc = c
        return h
    print([A304030(n) for n in range(1, 100)]) # Paolo Xausa, Feb 22 2022

A333860 The maximum Hamming (binary) weight of the elements of the Collatz orbit of n, or -1 if 1 is never reached.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 3, 1, 3, 2, 3, 2, 3, 3, 4, 1, 3, 3, 4, 2, 3, 3, 4, 2, 4, 3, 8, 3, 4, 4, 8, 1, 4, 3, 4, 3, 3, 4, 5, 2, 8, 3, 4, 3, 4, 4, 8, 2, 3, 4, 4, 3, 4, 8, 8, 3, 4, 4, 5, 4, 5, 8, 8, 1, 3, 4, 4, 3, 3, 4, 8, 3, 8, 3, 4, 4, 4, 5, 6, 2, 5, 8, 8, 3, 4, 4, 5
Offset: 1

Views

Author

Markus Sigg, Apr 08 2020

Keywords

Examples

			The Collatz orbit of 3 is 3,10,5,16,8,4,2,1. The Hamming weights are 2,2,2,1,1,1,1,1. The maximum is a(3) = 2.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Max[DigitCount[#, 2, 1] & /@ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]]; Array[a, 100] (* Amiram Eldar, Jul 29 2023 *)
  • PARI
    a(n) = {
    my(c = hammingweight(n));
    while(n>1, n = if(n%2 == 0, n/2, 3*n+1); c = max(c, hammingweight(n)));
    c;
    }

Formula

a(n) = max(A000120(n), A352895(n)) = max(A000120(n), a(A006370(n))). - Antti Karttunen, Apr 10 2022

Extensions

Escape clause added to the definition by Antti Karttunen, Apr 10 2022

A025587 '3x+1' record-setters (blowup factor).

Original entry on oeis.org

1, 3, 7, 15, 27, 703, 1819, 4255, 4591, 9663, 26623, 60975, 77671, 113383, 159487, 1212415, 2684647, 3041127, 3873535, 4637979, 5656191, 6416623, 6631675, 19638399, 80049391, 210964383, 319804831, 1410123943, 70141259775, 77566362559
Offset: 0

Views

Author

Keywords

Comments

This sequence uses the highest even number reached, which will always be a power of 2 larger than A295163. - Howard A. Landman, Nov 20 2017
A proper subsequence of A006884. - Robert G. Wilson v, Dec 23 2017
Let m be the maximum value in row n of A070165. This sequence is the record transform of the sequence m/n for n >= 1. - Michael De Vlieger, Mar 13 2018

Crossrefs

Cf. A295163 for maximum odd number reached, and A061523 for blowup factors.

Programs

  • C
    // First column is this sequence.
    // Second column is the maximum (even) N reached.
    // Third column is A061523, the ratio of those.
    // NOTE: This could be made faster by special-casing 1,
    // starting at 3, and incrementing by 4, since all terms except 1
    // are congruent to 3 (mod 4).
    #include    
    long long    i=1, n, max_n;
    long double    max_ratio=1.0, ratio;
    int main()
    {
        while(1)
        {
            n = i;
            max_n = n;
            while (n > i) // Can stop as soon as we drop below start.
            {
                n = 3*n + 1;
                max_n = (n > max_n) ? n : max_n;
                while (!(n&1))
                {
                    n >>= 1;
                }
             }
            ratio = (double) max_n / (double) i;
            if (ratio > max_ratio)
            {
                max_ratio = ratio;
                printf("%lld\t%lld\t%Lf\n", i, max_n, max_ratio);
            }
            i += 2;
        }
    }
    // Howard A. Landman, Nov 14 2017
  • Mathematica
    With[{s = Array[Max@ NestWhileList[If[EvenQ@#, #/2, 3 # + 1] &, #, # > 1 &]/# &, 2^18]}, Map[FirstPosition[s, #][[1]] &, Union@ FoldList[Max, s]]] (* Michael De Vlieger, Mar 13 2018 *)

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), May 03 2001
a(27) from Jud McCranie, Apr 23 2012
a(26) corrected (was missing least significant digit) by Howard A. Landman, Nov 14 2017

A101229 Perfect inverse "3x+1 conjecture" (See comments for rules).

Original entry on oeis.org

1, 2, 4, 1, 2, 4, 8, 16, 5, 10, 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 12288, 24576, 49152, 98304, 196608, 393216, 786432, 1572864, 3145728, 6291456, 12582912, 25165824, 50331648, 100663296, 201326592, 402653184, 805306368
Offset: 1

Views

Author

Alexandre Wajnberg, Jan 22 2005

Keywords

Comments

Perfect inverse "3x+1 conjecture": rule 1: multiply n by 2 to give n' = 2n. rule 2: when n'=(3x+1), do n"= (n'-1)/3 (n" integer) Additional rule: rule 2 is applied once for any number n' (otherwise, the sequence beginning with 1 would be the cycle "1 2 4 1 2 4 1 2 4 1..."); then apply rule 1.
This gives a particular sequence of hailstone numbers which may be considered as a central axis for all the hailstone number sequences. The perfect inverse "3x+1 conjecture" falls rapidly into the sequence 3 6 12 24 48 96... which will never give a number to which apply the 2nd rule.
a(n) for n >= 11 written in base 2: 11, 110, 11000, 110000, ..., i.e.: 2 times 1, (n-11) times 0 (see A003953(n-10)). - Jaroslav Krizek, Aug 17 2009

Examples

			The first 4 is followed by 1 because 4 = 3*1 + 1, so rule 2: (4-1)/3 = 1;
the second 4 is followed by 8 because the 2nd rule has already been applied, so rule 1: 4*2 = 8.
		

References

  • R. K. Guy, Collatz's Sequence, Section E16 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 215-218, 1994.

Crossrefs

Programs

  • Magma
    R:=PowerSeriesRing(Integers(), 45); Coefficients(R!( x*(17*x^10+27*x^8+7*x^3-1)/(2*x-1) )); // G. C. Greubel, Mar 20 2019
    
  • Mathematica
    Rest[CoefficientList[Series[x*(17*x^10+27*x^8+7*x^3-1)/(2*x-1), {x, 0, 45}], x]] (* G. C. Greubel, Mar 20 2019 *)
    LinearRecurrence[{2},{1,2,4,1,2,4,8,16,5,10,3},40] (* Harvey P. Dale, May 06 2023 *)
  • PARI
    my(x='x+O('x^45)); Vec(x*(17*x^10+27*x^8+7*x^3-1)/(2*x-1)) \\ G. C. Greubel, Mar 20 2019
    
  • Sage
    a=(x*(17*x^10+27*x^8+7*x^3-1)/(2*x-1)).series(x, 45).coefficients(x, sparse=False); a[1:] # G. C. Greubel, Mar 20 2019

Formula

a(n) = 3*2^(n-11) = 2^(n-11) + 2^(n-10) for n >= 11. - Jaroslav Krizek, Aug 17 2009
From Colin Barker, Apr 28 2013: (Start)
a(n) = 2*a(n-1) for n>11.
G.f.: x*(17*x^10+27*x^8+7*x^3-1) / (2*x-1). (End)

Extensions

More terms from Joshua Zucker, May 18 2006
Edited by G. C. Greubel, Mar 20 2019
Previous Showing 41-50 of 121 results. Next