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 51-58 of 58 results.

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

A334226 a(n) is the number of times that the number 3*k+1 from the Collatz trajectory of n is greater than n.

Original entry on oeis.org

0, 0, 2, 0, 1, 2, 5, 0, 6, 1, 4, 1, 2, 5, 5, 0, 2, 5, 5, 0, 1, 3, 3, 0, 6, 1, 40, 3, 4, 4, 38, 0, 7, 2, 2, 2, 3, 4, 9, 0, 39, 1, 5, 1, 2, 3, 37, 0, 3, 4, 4, 0, 1, 40, 40, 0, 5, 1, 5, 3, 4, 38, 38, 0, 3, 3, 3, 0, 1, 2, 35, 0, 40, 1, 3, 1, 2, 6, 6, 0, 4, 38, 38, 0, 1, 4, 4, 0, 3, 1, 31, 2, 3, 36, 36, 0, 41, 2, 2, 0
Offset: 1

Views

Author

Hamid Kulosman, May 11 2020

Keywords

Comments

The Collatz trajectory of the number n is a sequence starting with n and ending with 1 (obtained for the first time), constructed using even steps k to k/2 and odd steps k to 3*k+1. a(n) is the number of times in the Collatz trajectory of n that the number 3*k+1, obtained after the odd step k to 3*k+1, is greater than n. Alternatively, a(n) represents the number of odd terms in the Collatz trajectory of n that are greater than (n-1)/3. a(1)=0 since the Collatz trajectory of 1 has no steps.

Examples

			The Collatz trajectory of n=3 is 3, (10), 5, (16), 8, 4, 2, 1. It happens twice that the number 3*k+1 in this process is greater than n (those numbers 3*k+1 are in parentheses), so a(3)=2.
		

Crossrefs

Cf. A006667.

Programs

  • Mathematica
    a[n_] := Block[{c = NestWhileList[ If[ EvenQ@ #, #/2, 3 # + 1] &, n, #>1 & ]}, Length@ Select[ Range[2, Length[c]], OddQ[c[[# - 1]]] && c[[#]] > n &]]; Array[a, 90] (* Giovanni Resta, May 19 2020 *)
  • PARI
    a(n) = my(res=0, cn=n); while(n>1, if(bitand(n,1), n=3*n+1; if(n>cn, res++);, n>>=1)); res \\ David A. Corneth, May 20 2020

Formula

a(n) <= A006667(n). - David A. Corneth, May 20 2020

Extensions

More terms from Giovanni Resta, May 19 2020

A365503 In the Collatz (3x+1) problem, number of odd iterates before reaching 1 corresponding to the starting points given by A248037.

Original entry on oeis.org

0, 2, 5, 6, 41, 164, 189, 195, 207, 222, 228, 248, 256, 357, 583, 686, 850
Offset: 1

Views

Author

Paolo Xausa, Sep 06 2023

Keywords

Comments

Except for a(1), these values are listed in the fourth column of Table 1 in Kontorovich and Lagarias (2009, 2010).
See A365502 for corresponding total stopping times.

Crossrefs

Subsequence of A006667.

Formula

a(n) = A006667(A248037(n)).

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

A277365 a(n) is the smallest number k such that f(k) = f(n) + f(n+1) and g(k) = g(n) + g(n+1), where f(n) (resp. g(n)) is the number of halving (resp. tripling) steps to reach 1 in the Collatz ('3x+1') problem.

Original entry on oeis.org

2, 6, 12, 20, 34, 49, 56, 72, 98, 112, 144, 176, 196, 228, 224, 272, 344, 406, 392, 384, 448, 520, 576, 688, 688, 772, 913, 912, 912, 1028, 992, 1040, 1220, 1152, 1376, 1624, 1624, 1708, 1624, 1728, 1728, 1824, 2160, 2080, 2080, 2215, 2559, 2752, 2884, 2884, 2752
Offset: 1

Views

Author

Michel Lagneau, Oct 11 2016

Keywords

Comments

A006666: Number of halving steps to reach 1 in '3x+1' problem.
A006667: Number of tripling steps to reach 1 in '3x+1' problem.
We observe an interesting property: the subsequence {b(i)} of perfect squares is {49, 144, 196, 576, 3844, 12544, 15376, 51529, 61504, 246016, ...} with the property that b(3) = 4*b(1), b(4) = 4*b(2), b(7) = 4*b(5), b(9) = 4*b(7), b(10) = 4*b(9), ...
The primes of the sequence are 2, 2953, 3739, 9931, 38303, 44641, ...

Examples

			a(3) = 12 because (A006666(3), A006667(3)) = (f(3), g(3)) = (5, 2) => f(12) = f(3) + f(4) = 5 + 2 = 7 and g(12) = g(3) + g(4) = 2 + 0 = 2.
		

Crossrefs

Programs

  • Maple
    nn:=10^6:U:=array(1..nn):V:=array(1..nn):
    for i from 1 to nn do:
    m:=i:it0:=0:it1:=0:
       for j from 1 to nn while(m<>1) do:
        if irem(m,2)=0
         then
         m:=m/2:it0:=it0+1:
         else
         m:=3*m+1:it1:=it1+1:
        fi:
       od:
       U[i]:=it0:V[i]:=it1:
      od:
       for n from 1 to 100 do:
       ii:=0:
        for k from 1 to nn while(ii=0) do:
         if U[k]=U[n]+U[n+1] and V[k]=V[n]+V[n+1]
          then
          ii:=1:printf(`%d, `,k):
          else
         fi:
        od:
    od:

Extensions

Name edited by Michel Marcus, Sep 13 2017

A329535 Numbers with twice as many halving steps before reaching 1 in the 3x + 1 problem as tripling steps.

Original entry on oeis.org

1, 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, Nov 16 2019

Keywords

Comments

Essentially the same as A281665. - R. J. Mathar, Feb 07 2020
Numbers m such that A006666(m) = 2 * A006667(m).
Steps after reaching 1 the first time are ignored. For example, for 5, 16, 8, 4, 2, 1, 4, 2, 1, ..., only 8, 4, 2, 1 are counted for halving steps, the subsequent 4, 2, 1 subcycles are ignored.

Examples

			159 is in the sequence because its trajectory, 159, 478, 239, 718, ..., has 36 halving steps and 18 tripling steps.
160 is not in the sequence because its trajectory, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, has nine even terms but only two odd terms.
		

Crossrefs

Programs

  • Mathematica
    collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 50; t = {}; n = 0; While[Length[t] < nn, n++; c = collatz[n]; ev = Length[Select[c, EvenQ]]; od = Length[c] - ev - 1; If[ev == 2 * od, AppendTo[t, n]]]; t
  • Scala
    def halfTripleCompare(n: Int): Int = {
      var curr = n
      var htc = 0
      while (curr > 1) {
        curr = (curr % 2) match {
          case 0 => htc = htc + 1
            curr / 2
          case 1 => htc = htc - 2
            3 * curr + 1
        }
      }
      htc
    }
    (1 to 1000).filter(halfTripleCompare() == 0) // _Alonso del Arte, Nov 18 2019

A349873 Smallest odd value such that any Collatz trajectory in which it occurs contains exactly n odd values other than '1'.

Original entry on oeis.org

21, 3, 69, 45, 15, 9, 51, 33, 87, 57, 39, 105, 135, 363, 123, 339, 219, 159, 393, 519, 681, 897, 603, 111, 297, 1581, 1053, 351, 933, 621, 207, 549, 183, 243, 645, 429, 285, 189, 63, 165, 27, 147, 195, 129, 171, 231, 609, 411, 543, 1449, 975, 327, 873, 1185, 1527, 1017
Offset: 1

Views

Author

Keywords

Comments

a(n) necessarily is the first odd term in any Collatz trajectory in which it occurs.

Examples

			a(1)=21 as 21 occurs solely in Collatz trajectories starting with 21*2^k, and these trajectories all contain one single odd value other than 1. No value smaller than 21 satisfies these requirements. In particular, a(1) does not equal 5 since 5 is part of Collatz trajectories that contain multiple odd values other than 1 (e.g., ...,13,40,20,10,5,16,8,4,2,1).
a(2)=3 as 3 occurs solely in Collatz trajectories starting with 3*2^k, and these trajectories all contain exactly two odd values other than 1 (namely 3 and 5).
		

Crossrefs

All terms are in A016945.

Programs

  • PARI
    oddsteps(n)={my(s=0); while(n!=1, if(n%2,n=(3*n+1);s++); n/=2); s}
    a(n)={forstep(k=3, oo, 6, if(oddsteps(k)==n, return(k)))} \\ Andrew Howroyd, Dec 19 2021
    
  • PARI
    oddsteps(n)=my(s); while(n>1, n+=n>>1+1; if(!bitand(n,1), n >>= valuation(n,2)); s++); s
    first(n)=my(v=vector(n),r=n,t); forstep(k=3,oo,2, t=oddsteps(k); if(t<=n && v[t]==0, v[t]=k; if(r-- == 0, return(v)))) \\ Charles R Greathouse IV, Dec 22 2021

Formula

a(n) mod 6 = 3 for all n>0. The odd multiples of 3 form the 'Garden-of-Eden' set (terms without a predecessor) under iterations of the reduced Collatz function A075677.

A375888 Rectangular array: row n shows all k such that n is the number of rises in the trajectory of k in the Collatz problem.

Original entry on oeis.org

1, 2, 5, 4, 10, 3, 8, 20, 6, 17, 16, 21, 12, 34, 11, 32, 40, 13, 35, 22, 7, 64, 42, 24, 68, 23, 14, 9, 128, 80, 26, 69, 44, 15, 18, 25, 256, 84, 48, 70, 45, 28, 19, 49, 33, 512, 85, 52, 75, 46, 29, 36, 50, 65, 43, 1024, 160, 53, 136, 88, 30, 37, 51, 66, 86, 57
Offset: 0

Views

Author

Clark Kimberling, Sep 11 2024

Keywords

Comments

Assuming that the Collatz conjecture (also known as the 3x+1 conjecture) is true, this is a permutation of the positive integers; viz., every positive integer occurs exactly once. Conjecture: every row contains a pair of consecutive integers.

Examples

			Corner:
   1     2     4     8    16    32    64   128   256   512  1024
   5    10    20    21    40    42    80    84    85   160   168
   3     6    12    13    24    26    48    52    53    96   104
  17    34    35    68    69    70    75   136   138   140   141
  11    22    23    44    45    46    88    90    92    93   176
   7    14    15    28    29    30    56    58    60    61   112
   9    18    19    36    37    38    72    74    76    77    81
6 is in row 2 because the trajectory, (6, 3, 10, 5, 16, 4, 2, 1), has exactly 2 rises: 3 to 10, and 5 to 16.
		

Crossrefs

Cf. A000027, A000079 (row 1), A092893 (column 1), A006667, A070265, A078719.
Cf. A354236.

Programs

  • Mathematica
    t = Table[Count[Differences[NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]], ? Positive], {n, 2048}]; (* after _Harvey P. Dale, A006667 *)
    r[n_] := Flatten[Position[t, n - 1]];
    Column[Table[r[n], {n, 1, 21}]] (* array *)
    u = Table[r[k][[n + 1 - k]], {n, 1, 12}, {k, 1, n}]
    Flatten[u] (* sequence *)

Formula

Transpose of the array in A354236.
Previous Showing 51-58 of 58 results.