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.

A271973 Smallest number k such that gcd(s1, s2) = n, where s1 is the sum of the odd numbers and s2 is the sum of the even numbers in the Collatz (3x+1) trajectory of k.

This page as a plain text file.
%I A271973 #12 Sep 12 2017 21:31:47
%S A271973 1,10,9,30,65,5,74,86,368,135,970,50,95,101,1045,178,793,7,214,196,18,
%T A271973 423,133,200,2572,629,621,358,700,451,3167,1924,3611,1926,662,510,
%U A271973 6688,437,1525,5072,3724,3161,1034,240,5848,2487,704,442,19120,1230,5138,3524
%N A271973 Smallest number k such that gcd(s1, s2) = n, where s1 is the sum of the odd numbers and s2 is the sum of the even numbers in the Collatz (3x+1) trajectory of k.
%e A271973 a(6) = 5 because the Collatz trajectory of 5 is 5 -> 16 -> 8 -> 4 -> 2 -> 1 with s1 = 5+1 = 6 and s2 = 16+8+4+2 = 30 => gcd(6,30) = 6.
%p A271973 nn:=10^8:
%p A271973 for n from 1 to 60 do:
%p A271973 ii:=0:
%p A271973   for k from 1 to nn while(ii=0) do:
%p A271973    kk:=1:m:=k:T[kk]:=k:it:=0:
%p A271973     for i from 1 to nn while(m<>1) do:
%p A271973      if irem(m,2)=0
%p A271973       then
%p A271973        m:=m/2:kk:=kk+1:T[kk]:=m:
%p A271973       else
%p A271973       m:=3*m+1:kk:=kk+1:T[kk]:=m:
%p A271973      fi:
%p A271973     od:
%p A271973      s1:=0:s2:=0:
%p A271973       for j from 1 to kk do:
%p A271973        if irem(T[j],2)=1
%p A271973         then
%p A271973         s1:=s1+T[j]:
%p A271973         else
%p A271973         s2:=s2+T[j]:
%p A271973        fi:
%p A271973       od:
%p A271973        g:=gcd(s1,s2):
%p A271973        if g=n
%p A271973        then
%p A271973        ii:=1:printf("%d %d \n",n,k):
%p A271973        else fi:
%p A271973     od:
%p A271973    od:
%t A271973 Table[k = 1; While[n != GCD[Total@ Select[#, OddQ], Total@ Select[#, EvenQ]] &@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, k, # > 1 &], k++]; k, {n, 52}] (* _Michael De Vlieger_, Jul 13 2016 *)
%Y A271973 Cf. A213909, A213916.
%K A271973 nonn
%O A271973 1,2
%A A271973 _Michel Lagneau_, Jul 13 2016