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.

Showing 1-10 of 53 results. Next

A211981 Numbers n such that floor(2^A006666(n)/3^A006667(n)) = n.

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 10, 16, 21, 32, 42, 64, 75, 85, 113, 128, 151, 170, 227, 256, 341, 512, 682, 1024, 1365, 2048, 2730, 4096, 5461, 7281, 8192, 10922, 14563, 16384, 21845, 32768, 43690, 65536, 87381, 131072, 174762, 262144, 349525, 466033, 524288, 699050, 932067
Offset: 1

Views

Author

Michel Lagneau, Feb 13 2013

Keywords

Comments

A006666 and A006667 give the number of halving and tripling steps to reach 1 in 3x+1 problem.
Properties of this sequence:
A006667(a(n)) <= 3, and if a(n) is even then a(n)/2 is in the sequence.
The sequence A000079(n) (power of 2) is included in this sequence.
{a(n)} = E1 union E2 where E1 = {A000079(n)} union {5, 10, 21, 85, 170, 227, 341, 682, 1365, 2730, 5461, ...} and E2 = {75, 113, 151, 7281, ...}. If an element k of E1 generates the Collatz sequence of iterates k -> T_1(k) -> T_2(k) -> T_3(k) -> ... then any T_i(k) is an element of E1 of the form [2^a /3^b] where a = A006666(n), or A006666(n)-1, or ... and b = A006667(n), or A006667(n)-1, or ... But if k is an element of E2, there exists at least an element T_i(k) that is not in the sequence a(n). For example 75 -> 226 ->113 -> 340 -> ... and 226 is not in the sequence because, if [x] = [2^a /3^b] = [ x. x0 x1 x2 ...], the rational number 0.x0 x1 x2 ... > 0.666666.... => [2^a /3^(b-1)] of the form [(3x+2).y0 y1 y2 ...], and this integer is different from T_(i+1)(k) = [(3x+1).y0 y1 y2 ...] = 3x+1.
Example: T_2(75) = floor(2^10 /3^2) = 113 => floor(2^10/3^1) = 341 instead T_3(75) = 340.

Examples

			227 is in the sequence because A006666(227) = 11, A006667(227) = 2 => floor(2^11/3^2) = 227.
The Collatz trajectory of 227 is 227 -> 682 -> 341 -> 1024 -> 512 -> ... -> 2 -> 1, and 227 is in the subset E1 implies the following Collatz iterates:
227 = floor(2^11/3^2);
682 = floor(2^11/3^1);
341 = floor(2^10/3^1);
1024 = floor(2^10/3^0);
512 = floor(2^9/3^0);
256 = floor(2^8/3^0);
128 = floor(2^7/3^0);
...
2 = floor(2^1/3^0);
1 = floor(2^0/3^0);
With the numbers of E1, we obtain another formulation of the Collatz problem.
		

Crossrefs

Programs

  • Maple
    A:= proc(n) if type(n, 'even') then n/2; else 3*n+1 ; end if; end proc:
    B:= proc(n) a := 0 ; x := n ; while x > 1 do x := A(x) ; a := a+1 ; end do; a ; end proc:
    C:= proc(n) a := 0 ; x := n ; while x > 1 do if type(x, 'even') then x := x/2 ; else x := 3*x+1 ; a := a+1 ; end if; end do; a ; end proc:
    D:= proc(n) C(n) ; end proc:
    A006666:= proc(n) B(n)- C(n) ; end:
    A006667:= proc(n) C(n)- D(n) ; end:
    G:= proc(n) floor(2^ A006666 (n)/3^ A006667 (n)) ; end:
    for i from 1 to 1000000 do: if G(i) =i then printf(`%d, `,i):else fi:od:
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 30; t = {}; n = 0; While[Length[t] < nn, n++; c = Collatz[n]; ev = Length[Select[c, EvenQ]]; od = Length[c] - ev - 1; If[Floor[2^ev/3^od] == n, AppendTo[t, n]]]; t (* T. D. Noe, Feb 13 2013 *)

A225089 a(n) = floor(2^A006666(m)/3^A006667(m)) - m, where m = 2n + 1.

Original entry on oeis.org

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

Views

Author

Michel Lagneau, Apr 27 2013

Keywords

Comments

A006666 and A006667 are the number of halving and tripling steps to reach 1 in 3x+1 problem.
Properties of this sequence:
a(m) = 0 for m = A211981(m).

Examples

			a(9) = 3 because floor(2^A006666(19)/3^A006667(19)) - 19 = floor(2^14 /3^6) - 19 = floor(22.474622) - 19 = 22 - 19 = 3.
		

Crossrefs

Programs

  • Maple
    A:= proc(n) if type(n, 'even') then n/2; else 3*n+1 ; end if; end proc:
    B:= proc(n) a := 0 ; x := n ; while x > 1 do x := A(x) ; a := a+1 ; end do; a ; end proc:
    C:= proc(n) a := 0 ; x := n ; while x > 1 do if type(x, 'even') then x := x/2 ; else x := 3*x+1 ; a := a+1 ; end if; end do; a ; end proc:
    D:= proc(n) C(n) ; end proc:
    A006666:= proc(n) B(n)- C(n) ; end:
    A006667:= proc(n) C(n)- D(n) ; end:
    G:= proc(n) floor(2^A006666 (n)/3^A006667 (n)) ; end:
    for i from 1 to 100 do: printf(`%d, `, G(i)-i):od:
  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; nn = 100; t = {}; n = 0; While[Length[t] < nn, n++; c = Collatz[n]; ev = Length[Select[c, EvenQ]]; od = Length[c] - ev - 1; AppendTo[t, Floor[2^ev/3^od]-n]]; t

A076182 a(n) = A006666(n) mod 2.

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Nov 01 2002

Keywords

Crossrefs

Programs

  • PARI
    a(n)=if(n<0,0,s=n; c=0; while(s>1,s=(s%2)*(3*s+1)/2+(1-s%2)*s/2; c++); c)%2
    
  • Scheme
    (define (A076182 n) (modulo (A006666 n) 2))
    (definec (A006666 n) (if (= 1 n) 0 (+ 1 (A006666 (A014682 n))))) ;; With memoization-macro definec
    (define (A014682 n) (if (even? n) (/ n 2) (/ (+ n n n 1) 2)))
    ;; Antti Karttunen, Aug 13 2017

Formula

a(n) = A006513(n) - 1.
Apparently also the antiparity of A064433. - Ralf Stephan, Nov 16 2004

A304715 For any n > 0, if A006666(n) >= 0, then a(n) = Sum_{i = 0..A006666(n)-1} 2^i * [T^i(n) == 0 (mod 2)] (where [] is an Iverson bracket and T^i denotes the i-th iterate of the Collatz function A014682); otherwise a(n) = -1.

Original entry on oeis.org

0, 1, 28, 3, 14, 57, 1896, 7, 7586, 29, 948, 115, 118, 3793, 3824, 15, 474, 15173, 15180, 59, 62, 1897, 1912, 231, 60722, 237, 1102691417057682138372, 7587, 7590, 7649, 137836427132210267296, 31, 242890, 949, 956, 30347, 30350, 30361, 7772616, 119
Offset: 1

Views

Author

Rémy Sigrist, May 17 2018

Keywords

Comments

In other words, when a(n) >= 0, the binary representation of a(n) encodes the tripling and halvings steps of the Collatz compressed trajectory of n up to the first occurrence of the number 1 (where zeros and ones respectively denote tripling and halving steps).

Examples

			The first terms, alongside the binary representation of a(n) and the Collatz compressed trajectory of a(n) up to the first 1 in reverse order, are:
  n    a(n)       bin(a(n))  rev(traj(n))
  --   ----       ---------  ------------
   1      0               0  (1)
   2      1               1  (1, 2)
   3     28           11100  (1, 2, 4, 8, 5, 3)
   4      3              11  (1, 2, 4)
   5     14            1110  (1, 2, 4, 8, 5)
   6     57          111001  (1, 2, 4, 8, 5, 3, 6)
   7   1896     11101101000  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7)
   8      7             111  (1, 2, 4, 8)
   9   7586   1110110100010  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7, 14, 9)
  10     29           11101  (1, 2, 4, 8, 5, 10)
  11    948      1110110100  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11)
  12    115         1110011  (1, 2, 4, 8, 5, 3, 6, 12)
  13    118         1110110  (1, 2, 4, 8, 5, 10, 20, 13)
  14   3793    111011010001  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7, 14)
  15   3824    111011110000  (1, 2, 4, 8, 5, 10, 20, 40, 80, 53, 35, 23, 15)
  16     15            1111  (1, 2, 4, 8, 16)
  17    474       111011010  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17)
  18  15173  11101101000101  (1, 2, 4, 8, 5, 10, 20, 13, 26, 17, 11, 7, 14, 9, 18)
		

Crossrefs

Programs

  • PARI
    a(n) = my (v=0); for (k=0, oo, if (n==1, return (v), n%2, n = (3*n+1)/2, n = n/2; v += 2^k))

Formula

a(2^k) = 2^k - 1 for any k >= 0.
a(2*n) = 2*a(n) + 1.
A029837(a(n)+1) = A006666(n).
A000120(a(n)) = A220071(n).
a(A248573(n)) < a(A248573(n+1)) for any n >= 0. - Rémy Sigrist, Nov 09 2018

A232462 Number of iterations of the map n -> f(f(f(...f(n)...))) to reach the end of the cycle, where f(n) = A006666(n), the initial number n is not counted.

Original entry on oeis.org

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

Views

Author

Christoph Neubauer, Nov 24 2013

Keywords

Comments

The 3x+1 or Collatz problem is as follows: start with any number n. If n is even, divide it by 2, otherwise multiply it by 3 and add 1. As multiplying by 3 and adding 1 always gives an even number, the next step is always a division by 2. So there already exists a shortened version of Collatz problem: If n is even, multiply it by three, add one and divide the result by two, else divide it by two. A006666(n), which is the Number of halving steps to reach 1 in '3x+1' problem, also is the number of all steps for the shortened form to reach 1. If you map this function onto itself, you'll get a sequence that ends with 1 or 6 (for 6, 20, 21, 43, 64, 86, ...) or 73 (for 73, 216, 218, ...).

Examples

			For n = 3, the mapping of the shortened Collatz sequence is [3, 5, 4, 2, 1], its number of steps is 4. For n=6 the sequence is [6], the number of steps is 0.
		

Programs

  • Python
    #!/usr/bin/env python
    # output to
    outputStr = "b232462.txt"
    # max index
    maxIndex = 10000
    # goodies
    sep=" "
    eol="\n"
    # subroutine for collatz sequence; classical and shortened
    def collatz (n, k):
        # put starting number to list
        list = [n]
        # collatz assumption used as end criterion
        while (n > 1):
            # collatz formula
            if (n%2 == 0):
                n = n // 2
            else:
                n = (3*n + 1) // k  # if k==2 --> shortened
            # put new number to list
            list.append(n);
        # return complete list
        return list
    # subroutine for collatz composition; classical and shortened
    # composition:  collatz (collatz (collatz (...)))
    def composition (n, k):
        # put starting number to list
        list = [n]
        # calculate collatz(starting number)
        l = len (collatz(n, k))-1
        # while we do not have a cycle
        while ((l >= 1) and (not l in list)):
            # put new number to list
            list.append(l)
            # get next collatz number
            l = len (collatz(l, k))-1
        # return complete list
        return list
    # open output
    output = open (outputStr, 'w')
    # for index 1 to maxIndex
    for i in range (1, maxIndex+1):
        # compute complete composition sequence
        list = composition(i, 2)
        # get number of steps
        l = len(list)-1
        # write to file
        output.write (str(i)+sep+str(l)+eol)
    # close output
    output.close ()

A265099 Least k such that floor(2^A006666(k)/3^A006667(k)) - k = n.

Original entry on oeis.org

1, 6, 9, 19, 18, 27, 33, 37, 36, 50, 43, 56, 59, 66, 57, 74, 78, 72, 97, 87, 86, 98, 112, 119, 118, 134, 123, 115, 114, 130, 149, 148, 157, 135, 179, 144, 153, 187, 220, 174, 173, 172, 197, 196, 255, 224, 238, 219, 236, 203, 249, 268, 247, 246, 230, 229, 228
Offset: 0

Views

Author

Michel Lagneau, Dec 01 2015

Keywords

Comments

A006666 and A006667 are the number of halving and tripling steps to reach 1 in 3x+1 problem.
Conjecture: k exists for all n.
In other words, given an integer n, there always exists at least an integer k and a pair of integers (a, b) such that n + k = 2^a/3^b where a is the number of halving steps to reach 1, and b is the number of tripling steps to reach 1, in the 3x+1 problem.

Examples

			a(0) = 1 because A006666(1) = 0 and A006667(1) = 0 => floor(2^0/3^0) - 1 = 1 - 1 = 0;
a(1) = 6 because A006666(6) = 6 and A006667(6) = 2 => floor(2^6/3^2) - 6 = floor(64/9) - 6 = 7 - 6 = 1.
		

Crossrefs

Programs

  • Mathematica
    lst={};Do[Collatz[k_]:=NestWhileList[If[EvenQ[#],#/2,3 #+1]&,k,#>1&];nn=500;t={};k=0;While[Length[t]
    				

A277367 a(n) = gcd(A006666(n), A006667(n)) where A006666 and A006667 are respectively the number of halving and tripling steps in the '3x+1' problem.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 1, 3, 1, 1, 2, 1, 1, 1, 1, 4, 3, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 5, 2, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 4, 4, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 1, 2, 10, 10, 1, 1, 3, 3
Offset: 1

Views

Author

Michel Lagneau, Oct 11 2016

Keywords

Examples

			a(17) = 3 because gcd(A006666(17), A006667(17)) = gcd(9, 3) = 3.
		

Crossrefs

Programs

Formula

a(2^m) = m.

A281938 a(n) is the least k such that gcd(A006666(k), A006667(k)) = n.

Original entry on oeis.org

2, 4, 8, 16, 32, 64, 128, 256, 512, 82, 129, 4096, 327, 16384, 32768, 1249, 35655, 159, 4926, 283, 377, 502, 603, 799, 1063, 1417, 1889, 2518, 3356, 4472, 5960, 7944, 10594, 14124, 18833, 25110, 33481, 44641, 59521, 79361, 105814, 141084, 188113, 250817, 334422
Offset: 1

Views

Author

Michel Lagneau, Feb 02 2017

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.
a(n) = 2^n for n = 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 12, 14, 15.
The primes in the sequence are 2, 283, 1063, 1249, 1889, 44641, ...

Examples

			a(10) = 82 because gcd(A006666(82), A006667(82)) = gcd(70, 40) = 10, and there is no k < 82 such that gcd(A006666(k), A006667(k)) = 10.
		

Crossrefs

Programs

  • Maple
    for n from 1 to 45 do:
    ii:=0:
    for k from 2 to 10^7 while(ii=0) do:
      m:=k: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:
        if gcd(s1,s2)=n
         then
         ii:=1:printf(`%d %d \n`,n,k):
         else
        fi:
    od:
    od:
  • Mathematica
    Function[w, First /@ Lookup[w, Function[k, If[k == {}, #, Take[#, First@ k]]]@ Complement[Range@ Max@ #, #]] &@ Keys@ w]@ KeySort@ PositionIndex@ Table[GCD[Count[NestWhileList[If[OddQ[#], 3 # + 1, #/2] &, n, # > 1 &], ?(EvenQ[#] &)], Count[Differences[NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]], ?Positive]], {n, 2^16}] (* Michael De Vlieger, Feb 02 2017, Version 10, after Harvey P. Dale at A006666 and A006667 *)

A304119 Numerators of record low values of the ratio n*3^A006667(n)/2^A006666(n).

Original entry on oeis.org

1, 27, 1701, 6561, 1760826122505, 115093142840908791, 460166680231540515, 1840049047529878113
Offset: 1

Views

Author

Michel Lagneau, May 03 2018

Keywords

Comments

This has been verified for n up to 10^7.
Conjecture: Consider A006666 and A006667, the sequences giving the number of halving and tripling steps to reach 1 in 3x+1 problem. There exists a rational constant c such that c <= n*3^A006667(n)/2^A006666(n) <= 1 where c = 1840049047529878113/2305843009213693952 is the last term in the sequence of the ratios.
Note that n*3^A006667(n)/2^A006666(n) = 1 if n is a power of 2 (A000079).
It seems that n*3^A006667(n)/2^A006666(n) = c for n = 993*2^k, k = 0, 1, 2, ... In this case, c = 993*2^k*3^32/2^(61+k), where 32 = A006667(993*2^k) and 61+k = A006666(993*2^k). For example, c = 993*3^32/2^61 = 1986*3^32/2^62 = 3972*3^32/2^63 = 7944*3^32/2^64 = ...

Examples

			For n=1 to 10 the ratios are: 1, 1, 27/32, 1, 15/16, 27/32, 1701/2048, 1, 6561/8192, 15/16, so the low records are 1, 27/32, 1701/2048, 6561/8192, ...
		

Crossrefs

Cf. A006666, A006667, A127789 (for the indices where these records occur).

Programs

  • Mathematica
    q=1; Collatz[n_]:=NestWhileList[If[EvenQ[#], #/2, 3 #+1]&, n, #>1&]; nn=5000; t={}; n=0; While[Length[t]
    				
  • PARI
    ht(n) = my(h, t); while(n>1, if(n%2, n=3*n+1; t++, n>>=1; h++)); return([h, t]);
    lista(nn) = {m = 2; for (n=1, nn, v = ht(n); newm = n*3^v[2]/2^v[1]; if (newm < m, print1(numerator(newm), ", "); m = newm));} \\ Michel Marcus, May 06 2018

A123481 Record n for the sequence A006666(n)/log(n), for n > 1; i.e., the n at which the number of steps to 1 for the halving-Collatz iteration divided by log(n) sets a new maximum.

Original entry on oeis.org

2, 3, 7, 9, 27, 230631, 626331, 837799, 1723519, 3732423, 6649279, 8400511, 63728127, 3743559068799, 100759293214567, 104899295810901231
Offset: 1

Views

Author

Diego Dominici (dominicd(AT)newpaltz.edu), Apr 16 2007

Keywords

Comments

These numbers (for n > 2, at least) are called "Abby-Normal" numbers by Dominici in the referenced paper (definition 21); 2 is included here to agree with the RECORDS transform convention. - D. S. McNeil, Mar 26 2009
Three further terms are known (see Roosendaal) but they may not be the next three terms. - N. J. A. Sloane, Oct 21 2012

Extensions

Definition edited by D. S. McNeil, Mar 26 2009
Extended by D. S. McNeil, Mar 26 2009
a(13) from Donovan Johnson, Feb 16 2011
a(14)-a(16) from Roosendaal's table added by N. J. A. Sloane, Oct 21 2012
Showing 1-10 of 53 results. Next