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 53 results. Next

A182078 Odd numbers n such that the reduced Collatz map n -> (3n+1)/2^k gives a trajectory of decreasing odd numbers.

Original entry on oeis.org

5, 13, 17, 21, 45, 53, 69, 85, 113, 141, 181, 213, 241, 277, 301, 321, 341, 369, 401, 453, 565, 725, 753, 853, 909, 965, 1069, 1109, 1137, 1205, 1285, 1365, 1425, 1477, 1605, 1713, 1813, 1933, 1969, 2261, 2417, 2573, 2577, 2625, 2901, 2957, 3013, 3213, 3413
Offset: 1

Views

Author

Michel Lagneau, Apr 10 2012

Keywords

Examples

			45 is in the sequence because 45 generates the trajectory of odd numbers : 45 -> 17 -> -> 13 -> 5 -> 1.
		

Crossrefs

Cf. A006666, A075677 (reduced Collatz map), A256598 (trajectory).

Programs

  • Maple
    for n from 3 by 2 to 5000 do:i:=0:x:=n:n0:=n: u0:=0:for it from 1 to 1000 while(n0<>1 and u0=0) do: for a from 1 to 100 while(x mod 2 = 0 ) do: i:=i+1:x:=x/2: od:if x > n0 then u0:=1:else i:=i+1:n0:=x :x:=3*n0+1: fi:od: if u0=0 then printf(`%d, `,n):else fi:od:

A281665 Numbers m such that A006667(m)/A006577(m) = 1/3.

Original entry on oeis.org

159, 283, 377, 502, 503, 603, 615, 668, 669, 670, 799, 807, 888, 890, 892, 893, 1063, 1065, 1095, 1186, 1187, 1188, 1189, 1190, 1417, 1435, 1580, 1581, 1582, 1585, 1586, 1587, 1889, 1913, 1947, 1959, 1963, 2104, 2106, 2108, 2109, 2113, 2114, 2115, 2119, 2518
Offset: 1

Views

Author

Michel Lagneau, Jan 31 2017

Keywords

Comments

A006667: number of tripling steps to reach 1 in '3x+1' problem.
A006577: number of halving and tripling steps to reach 1 in '3x+1' problem.
The corresponding number of iterations A006577(a(n)) is given by the sequence 54, 60, 63, 66, 66, 69, 69, 69, 69, 69, 72, 72, 72, 72, 72, 72, 75, 75, ... and the set of the distinct values of this sequence is {b(n)} = {54, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, ...}. We observe that {b(k)} = {54} union {60 + 3*k} for k = 1, 2, ...

Examples

			159 is in the sequence because A006667(159)/A006577(159) = 18/54 = 1/3.
		

Crossrefs

Programs

  • Maple
    nn:=10000:
    for n from 2 to 3000 do:
      m:=n:s1:=0:s2:=0:
       for i from 1 to nn while(m<>1) do:
        if irem(m,2)=0
         then
         s2:=s2+1:m:=m/2:
         else
         s1:=s1+1:m:=3*m+1:
        fi:
       od:
       s:=s1/(s1+s2):
        if s=1/3
         then
         printf(`%d, `,n):
         else
        fi:
    od:

A282408 Numbers k for which the number of odd members and the number of even members in the Collatz (3x+1) trajectory are both a perfect square.

Original entry on oeis.org

1, 2, 16, 17, 322, 323, 512, 1595, 1598, 1599, 1609, 1614, 1615, 1627, 1641, 1643, 1657, 1663, 1776, 1780, 1781, 1784, 1786, 2176, 2208, 2216, 2218, 2240, 2256, 2260, 2261, 2274, 2275, 2400, 2408, 2410, 2416, 2417, 2420, 2421, 3844, 3845, 3846, 3848, 3850, 3852
Offset: 1

Views

Author

Michel Lagneau, Feb 14 2017

Keywords

Comments

Or numbers m such that A078719(m) and A006666(m) are both a perfect square.
For k < 5*10^6, the fourteen distinct pairs of squares in the order of appearance are: (1, 0), (1, 1), (1, 4), (4, 9), (36, 64), (1, 9), (25, 49), (4, 16), (16, 36), (9, 25), (1, 16), (81, 144), (4, 25) and (64, 121).
The numbers 2^(m^2) = A002416(m) are in the sequence, and the corresponding pairs of squares are (1, m^2).
Number of terms <= 10^h: 2, 4, 7, 202, 203, 474, 20888, etc. Robert G. Wilson v, Feb 14 2017

Examples

			17 is in the sequence because the Collatz trajectory is 17 -> 52 -> 26 -> 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 => the number of odd members is 4 = 2^2 and number of even members is 9 = 3^2.
		

Crossrefs

Programs

  • Maple
    nn:=10^6:
    for n from 1 to 10000 do:
      m:=n:i1:=1:i2:=0:
       for i from 1 to nn while(m<>1) do:
        if irem(m,2)=0
         then
         m:=m/2:i2:=i2+1:
         else
         m:=3*m+1:i1:=i1+1:
        fi:
       od:
        if sqrt(i1)=floor(sqrt(i1)) and sqrt(i2)=floor(sqrt(i2))
         then
         printf(`%d, `,n):
         else
        fi:
    od:
  • Mathematica
    fQ[n_] := Block[{m = n, e = 0, o = 1}, While[m > 1, If[OddQ@ m, m = 3 m + 1; o++, m /= 2; e++]]; IntegerQ@ Sqrt@ e && IntegerQ@ Sqrt@ o]; Select[ Range@ 3855, fQ] (* Robert G. Wilson v, Feb 14 2017 *)
    memsqQ[n_]:=Module[{col=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&]}, AllTrue[ {Sqrt[ Count[ col, ?(EvenQ[#]&)]],Sqrt[Count[col,?(OddQ[ #]&)]]},IntegerQ]]; Select[Range[4000],memsqQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 04 2018 *)

A282409 Numbers n for which the number of odd members and the number of even members in the Collatz (3x+1) trajectory are both prime.

Original entry on oeis.org

3, 9, 10, 12, 13, 22, 23, 40, 42, 73, 88, 90, 92, 93, 114, 115, 118, 119, 144, 148, 149, 152, 154, 162, 163, 164, 165, 166, 192, 208, 212, 213, 226, 227, 251, 295, 318, 319, 350, 351, 576, 592, 596, 597, 608, 616, 618, 625, 640, 642, 643, 648, 650, 652, 653
Offset: 1

Views

Author

Michel Lagneau, Feb 14 2017

Keywords

Comments

Or numbers m such that A078719(m) and A006666(m) are both prime.
The distinct pairs of primes in the order of appearance are: (3, 5), (7, 13), (2, 5), (3, 7), (5, 11), (2, 7), (43, 73), (5, 13), (11, 23), (7, 17), (41, 71), (3, 11), (23, 43), (19, 37),...

Examples

			13 is in the sequence because its Collatz trajectory is 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 which contains 3 odd members and 7 even members.
		

Crossrefs

Programs

  • Maple
    nn:=10^6:
    for n from 1 to 500 do:
      m:=n:i1:=1:i2:=0:
       for i from 1 to nn while(m<>1) do:
        if irem(m,2)=0
         then
         m:=m/2:i2:=i2+1:
         else
         m:=3*m+1:i1:=i1+1:
        fi:
       od:
         if isprime(i1) and isprime(i2)
         then
         printf(`%d, `,n):
         else
        fi:od:
  • PARI
    is(n)=my(e,o=1); while(n>1, n=if(n%2, o++; 3*n+1, e++; n/2)); isprime(e) && isprime(o) \\ Charles R Greathouse IV, Feb 14 2017
    
  • Python
    from sympy import isprime
    def a(n):
        l=[n]
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            l.append(n)
            if n<2: break
        o=list(filter(lambda i: i%2==1, l))
        e=list(filter(lambda i: i%2==0, l))
        return [o, e]
    print([n for n in range(2, 1001) if isprime(len(a(n)[0])) and isprime(len(a(n)[1]))]) # Indranil Ghosh, Apr 14 2017

A316783 Seed values of hailstone sequences for which, by the time they first reach 1, the ratio of odd terms to even terms is exactly 1/2. (The seed value itself is included in the ratio calculation.)

Original entry on oeis.org

4, 5, 6, 11, 14, 15, 18, 19, 25, 33, 43, 57, 59, 78, 79, 105, 135, 139, 185, 187, 191, 246, 247, 249, 254, 255, 329, 338, 339, 359, 427, 438, 439, 443, 450, 451, 478, 479, 569, 585, 590, 591, 601, 636, 637, 638, 758, 759, 767, 779, 786, 787, 801, 849, 850, 851
Offset: 1

Views

Author

Matt Enlow, Jul 13 2018

Keywords

Comments

1/2 is the most common odd/even ratio for these sequences. For seed values from 2 to 2^17, it is the odd/even ratio for 4454 of those sequences. The next most common ratio is 5/11, with 1834 sequences. (This is all empirical observation, using Mathematica.)

Examples

			The hailstone sequence starting with 11 (and ending at 1) is 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1. Five of those terms are odd, and the other ten are even, giving an odd/even ratio of 1/2. Therefore 11 is a term in this sequence.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n=1, [1, 0],
          `if`(n::odd, [1, 0]+b(3*n+1), [0, 1]+b(n/2)))
        end:
    a:= proc(n) option remember; local k; for k from a(n-1)
          +1 while (l-> 2*l[1]<>l[2])(b(k)) do od; k
        end: a(0):=0:
    seq(a(n), n=1..100);  # Alois P. Heinz, Aug 02 2018
  • Mathematica
    collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1]&, n, # != 1 &];
    A316783 = Select[Range[2, 1000], With[{c = Mod[collatz[#], 2]}, 2 Total[c] == Total[1 - c]] &]
  • PARI
    is(n) = my(x=n, even=0, odd=0); while(1, if(x%2==0, x=x/2; even++, x=3*x+1; odd++); if(x==1, odd++; break)); odd/even==1/2 \\ Felix Fröhlich, Jul 13 2018

Formula

{ k : A006666(k)/A078719(k) = 2 }. - Alois P. Heinz, Aug 02 2018

A348094 If the Collatz trajectory of n reaches 1, say after k steps, and there is an integer m > n such that T^i(m) and T^i(n) have the same parity for i = 0..k (where T^i denotes the i-th iterate of the Collatz map A006370), then a(n) is the least such m, otherwise a(n) is -1.

Original entry on oeis.org

2, 4, 35, 8, 21, 70, 2055, 16, 8201, 42, 1035, 140, 141, 4110, 4111, 32, 529, 16402, 16403, 84, 85, 2070, 2071, 280, 65561, 282, 1180591620717411303451, 8220, 8221, 8222, 147573952589676412959, 64, 262177, 1058, 1059, 32804, 32805, 32806, 8388647, 168
Offset: 1

Views

Author

Rémy Sigrist, Sep 29 2021

Keywords

Comments

When a(n) > 0, the binary expansion of A125711(n) is a prefix of that of A125711(a(n)).

Examples

			The first terms, alongside the binary representations of A125711(n) and of A125711(a(n)), are:
  n  a(n)  h(n)               h(a(n))
  -  ----  -----------------  --------------------------------------
  1     2                  1                                      11
  2     4                 11                                     111
  3    35           10101111                          10101111101111
  4     8                111                                    1111
  5    21             101111                                10111111
  6    70          110101111                         110101111101111
  7  2055  10101011011101111  10101011011101111110111010101111101111
  8    16               1111                                   11111
		

Crossrefs

Programs

  • Mathematica
    A348094[n_] := n+2^(Length[NestWhileList[If[OddQ[#], 3#+1, #]/2 &, n, #>1 &]]-1);
    Array[A348094, 50] (* Paolo Xausa, Apr 05 2024 *)
  • PARI
    a(n) = { my (h=0, r=n); while (r>1, if (r%2, r=3*r+1, r=r/2; h++)); n+2^h }

Formula

a(2^k) = 2^(k+1) for any k >= 0.
a(n) = n + 2^A006666(n) when A006666(n) >= 0.

A365502 In the Collatz problem, total stopping times for iteration of the 3x+1 function corresponding to the starting points given by A248037.

Original entry on oeis.org

1, 5, 11, 13, 70, 278, 319, 329, 349, 374, 384, 416, 429, 592, 966, 1134, 1404
Offset: 1

Views

Author

Paolo Xausa, Sep 06 2023

Keywords

Comments

The 3x+1 function (A014682), denoted by T(x) in the literature, is defined as T(x) = (3x+1)/2 if x is odd, T(x) = x/2 if x is even.
The total stopping time is the number of iterations of the T(x) map required to reach 1.
Except for a(1), these values are listed in the third column of Table 1 in Kontorovich and Lagarias (2009, 2010).
See A365503 for corresponding number of odd iterates before reaching 1.

Crossrefs

Subsequence of A006666.

Formula

a(n) = A006666(A248037(n)).

A370350 Number of steps to go from n to 1 in a variant of the Collatz iteration x -> (x / 5 if 5 divides x, x + (x+(5-(x mod 5)))/5 otherwise), or -1 if 1 is never reached.

Original entry on oeis.org

0, 4, 3, 2, 1, 7, 17, 6, 16, 5, 15, 5, 5, 14, 4, 4, 13, 11, 11, 3, 12, 10, 10, 20, 2, 11, 9, 9, 19, 8, 69, 10, 8, 8, 18, 17, 18, 68, 9, 7, 7, 8, 77, 16, 17, 67, 8, 17, 8, 6, 7, 76, 15, 7, 16, 66, 7, 16, 7, 6, 75, 6, 75, 14, 6, 6, 16, 65, 6, 15, 6, 15, 24, 74
Offset: 1

Views

Author

Giuseppe Ciacco, Feb 16 2024

Keywords

Comments

Because ceiling(a/b) = (a+(b-(a mod b)))/b, this sequence equals the total number of steps to reach 1 in a variant of the Collatz problem using the iteration f(x) := x/k if k divides x, x+ceiling(x/k) otherwise.
Specifically, here we set k=5 because it is the next integer (after 2) that is not in A368136; i.e. the iteration used here has no loops for starting values up to 5*5=25, apart from the loop containing 1.
It is not known if there exists n such that a(n) = -1 (either by iteration reaching a non-elementary loop which implies n>5*5, or by iteration growing without bound).

Examples

			For n = 11, the following trajectory is obtained:
  11, 14, 17, 21, 26, 32, 39, 47, 57, 69, 83, 100, 20, 4, 5, 1
which requires 15 steps to reach 1, therefore a(11) = 15.
		

Crossrefs

Programs

  • Mathematica
    s={};Do[c=0;a=n;While[a>1,If[Divisible[a,5],a=a/5,a=a+Ceiling[a/5]];c++];AppendTo[s,c],{n,74}];s (* James C. McMahon, Feb 28 2024 *)
  • Python
    def a(n, C = 5):
        s = 0
        while n > 1:
            d, r = divmod(n, C)
            n = n + 1 + d if r else d
            s += 1
        return s
    print([a(n) for n in range(1, 75)])
    # Giuseppe Ciacco and Robert Munafo, Mar 25 2024

A174539 Starting numbers n such that the number of halving and tripling steps to reach 1 under the Collatz 3x+1 map is a perfect square.

Original entry on oeis.org

1, 2, 7, 12, 13, 16, 44, 45, 46, 80, 84, 85, 98, 99, 100, 101, 102, 107, 129, 153, 156, 157, 158, 169, 272, 276, 277, 280, 282, 300, 301, 302, 350, 351, 512, 576, 592, 596, 597, 608, 616, 618, 625, 642, 643, 644, 645, 646, 648, 649, 650, 651, 652, 653, 654, 655, 662, 663
Offset: 1

Views

Author

Michel Lagneau, Mar 21 2010

Keywords

Comments

Numbers n such that A006577(n) is a perfect square.

Examples

			44, 45 and 46 are in the sequence because the number of steps as counted in A006577 for each of them is 16 = 4^2, a perfect square.
		

Crossrefs

Programs

  • Maple
    with(numtheory):for x from 1 to 200 do traj:=0: n1:=x: x1:=x: for p from 1 to 20 while(irem(x1,2)=0)do p1:=2^p: xx1:=x1: x1:=floor(n1/p1): traj:=traj+1:od:
    n:=x1: for q from 1 to 100 while(n<>1)do n1:=3*n+1: traj:=traj+1: x0:=irem(n1,2): for p from 1 to 20 while(x0=0)do p1:=2^p: xx1:=x1: x1:=floor(n1/p1): x0:=n1-p1*x1: traj:=traj+1: od: traj:=traj-1: n:=xx1:od:
    if(sqrt(traj))=floor(sqrt(traj)) then print(x):else fi:od:
  • Mathematica
    htsQ[n_]:=With[{len=Length[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&]]-1},IntegerQ[Sqrt[len]]]; Select[Range[700],htsQ] (* Harvey P. Dale, Jan 01 2023 *)

Formula

{n: A006577(n) in A000290}.

Extensions

Unspecific references removed - R. J. Mathar, Mar 31 2010
Corrected and extended by Harvey P. Dale, Jan 01 2023

A268338 Numbers that cycle under the following transformation: if m is even, divide by 2, if m is congruent to 1 mod 4, multiply by 3 and add 1; if m is congruent to 3 mod 4, multiply by 7 and add 1.

Original entry on oeis.org

1, 2, 4, 19, 23, 31, 38, 41, 46
Offset: 1

Views

Author

David Consiglio, Jr., Feb 01 2016

Keywords

Comments

Some numbers appear to grow indefinitely under these rules, but it is possible that they may eventually cycle at some point. All numbers up to 50 either cycle or transform to another number that cycles (typically 1). 51 is the first open case: it may eventually cycle or may continue to grow indefinitely.

Examples

			23 is a member of this sequence. 23 is congruent to 3 mod 4.  As a result, 23 transforms to 23*7+1 = 162.  From there 162 -> 81 -> 244 -> 122 -> 61 -> 184 -> 92 -> 46 -> 23.  23 is the least member of this cycle.
49 is not a member of this sequence because it eventually reduces to 19, which cycles.
		

Crossrefs

Programs

  • Python
    a = 1
    b = 1
    prev = []
    keep = []
    count = 0
    while b < 51:
        keep.append(a)
        flag1 = False
        flag2 = False
        if a % 2 == 0:
            a /= 2
        elif a % 4 == 1:
            a = a*3+1
        else:
            a = a*7+1
        if count > 50:
            b += 1
            a = b
            count = 0
            keep = []
        if keep.count(a) == 2 and a not in prev and a <= 50:
            prev.append(a)
            count = 0
            keep = []
            b += 1
            a = b
        count += 1
    print(sorted(prev))
    # David Consiglio, Jr., Feb 01 2016

Extensions

Corrected and edited by David Consiglio, Jr., Apr 20 2016
Previous Showing 41-50 of 53 results. Next