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.

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