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-6 of 6 results.

A277068 a(n) = gcd(s1, s2), 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 n.

Original entry on oeis.org

1, 1, 1, 1, 6, 1, 18, 1, 3, 2, 1, 1, 1, 2, 2, 1, 2, 21, 1, 6, 2, 1, 3, 1, 2, 1, 2, 6, 2, 4, 2, 1, 1, 4, 2, 3, 1, 1, 2, 2, 3, 2, 2, 1, 1, 1, 1, 1, 2, 12, 2, 1, 1, 2, 2, 2, 1, 4, 3, 4, 2, 2, 2, 1, 5, 1, 1, 4, 2, 2, 2, 3, 1, 7, 2, 1, 1, 2, 2, 6, 7, 1, 1, 2, 2, 8
Offset: 1

Views

Author

Michel Lagneau, Sep 28 2016

Keywords

Comments

Statistics of a(n) for the first 10^6 terms:
+------+-----------------+------------+
| | number of terms | |
| | such that | |
| n | gcd(s1, s2) = n | percentage |
+------+-----------------+------------+
| 1 | 401614 | 40.16% |
| 2 | 305471 | 30.54% |
| 3 | 44381 | 4.44% |
| 4 | 76228 | 7.62% |
| 5 | 15966 | 1.60% |
| 6 | 34514 | 3.45% |
| 7 | 8969 | 0.90% |
| 8 | 19156 | 1.92% |
| 9 | 4941 | 0.49% |
| 10 | 12212 | 1.22% |
| 11 | 3316 | 0.33% |
| 12 | 8234 | 0.82% |
| > 12 | 64998 | 6.50% |
+------+-----------------+------------+
It seems that the values of the third column oscillate infinitely when n tend towards infinity.
Records: 1, 6, 18, 21, 23, 93, 187, 560, 1730, 5098, 10552, 11060, 11657, 31072, 32468, 306770, 793906, 1956888, 3107101, 12210181, etc.; they appear at 1, 5, 7, 18, 133, 147, 186, 270, 839, 5090, 5244, 5488, 23255, 62132, 113624, 153341, 793842, 6849034, 9321240, 12210146, etc. - Robert G. Wilson v, Oct 03 2016

Examples

			a(5)=6 because the Collatz trajectory of 5 is 5 -> 16 -> 8 -> 4 -> 2 -> 1 => s1 = 5+1 = 6, s2 = 16+8+4+2 = 30, and gcd(6, 30) = 6.
		

Crossrefs

Programs

  • Maple
    nn:=10^7:
    for n from 1 to 100 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+m:m:=m/2:
         else
         s1:=s1+m:m:=3*m+1:
        fi:
       od:
         x:=gcd(s1+1,s2): printf(`%d, `,x):
      od:
  • Mathematica
    Collatz[n_] := NestWhileList[ If[ OddQ[#], 3#+1, #/2] &, n, # > 1 &]; f[n_] := Block[{c = Collatz@ n}, GCD[Plus @@ Select[c, OddQ], Plus @@ Select[c, EvenQ]]]; Array[f, 86] (* Robert G. Wilson v, Oct 03 2016 *)
  • PARI
    a(n) = {my(se = 0); my(so = 0); while (n!=1, if (n % 2, so+=n; n = 3*n+1, se +=n; n = n/2);); gcd(se, so+1);} \\ Michel Marcus, Oct 03 2016

A213917 Difference between sum of all even and the sum of all odd numbers in Collatz (3x+1) trajectory of n.

Original entry on oeis.org

-1, 1, 31, 5, 24, 37, 180, 13, 213, 34, 165, 49, 81, 194, 430, 29, 142, 231, 329, 54, 104, 187, 399, 73, 418, 107, 60916, 222, 290, 460, 60716, 61, 535, 176, 352, 267, 353, 367, 1444, 94, 60861, 146, 842, 231, 335, 445, 60653, 121, 526, 468, 722, 159, 281
Offset: 1

Views

Author

Jayanta Basu, Mar 05 2013

Keywords

Crossrefs

Programs

  • Mathematica
    Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Table[c = Collatz[n]; Total[Select[c, EvenQ]] - Total[Select[c, OddQ]], {n, 100}] (* T. D. Noe, Mar 05 2013 *)

Formula

a(n) = A213909(n) - A213916(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.

Original entry on oeis.org

1, 10, 9, 30, 65, 5, 74, 86, 368, 135, 970, 50, 95, 101, 1045, 178, 793, 7, 214, 196, 18, 423, 133, 200, 2572, 629, 621, 358, 700, 451, 3167, 1924, 3611, 1926, 662, 510, 6688, 437, 1525, 5072, 3724, 3161, 1034, 240, 5848, 2487, 704, 442, 19120, 1230, 5138, 3524
Offset: 1

Views

Author

Michel Lagneau, Jul 13 2016

Keywords

Examples

			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.
		

Crossrefs

Programs

  • Maple
    nn:=10^8:
    for n from 1 to 60 do:
    ii:=0:
      for k from 1 to nn while(ii=0) do:
       kk:=1:m:=k:T[kk]:=k:it:=0:
        for i from 1 to nn while(m<>1) do:
         if irem(m,2)=0
          then
           m:=m/2:kk:=kk+1:T[kk]:=m:
          else
          m:=3*m+1:kk:=kk+1:T[kk]:=m:
         fi:
        od:
         s1:=0:s2:=0:
          for j from 1 to kk do:
           if irem(T[j],2)=1
            then
            s1:=s1+T[j]:
            else
            s2:=s2+T[j]:
           fi:
          od:
           g:=gcd(s1,s2):
           if g=n
           then
           ii:=1:printf("%d %d \n",n,k):
           else fi:
        od:
       od:
  • Mathematica
    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 *)

A274796 Numbers n such that s2/s1 is an integer, where s1 is the sum of the odd numbers and s2 is the sum of the even numbers in the Collatz (3x+1) iteration of n.

Original entry on oeis.org

1, 2, 4, 5, 8, 16, 20, 32, 64, 80, 128, 186, 256, 320, 512, 704, 1024, 1280, 1344, 2048, 3808, 4096, 5090, 5120, 6464, 8192, 10152, 15904, 16384, 20480, 21760, 28672, 32768, 34640, 59392, 62132, 65536, 81920, 106496, 131072, 138880, 217824, 262144, 327680
Offset: 1

Views

Author

Michel Lagneau, Jul 07 2016

Keywords

Comments

Or numbers n such that A213909(n)/A213916(n) is an integer.
The powers of 2 are in the sequence because s1 = 1.
The corresponding integers s2/s1 are 0, 2, 6, 5, 14, 30, 10, 62, 126, 30, 254, 6, 510, 110, 1022, 34, 2046, 430, 126, 4094, 14, 8190, 6, 1710, 70, 16382, 14, 37, 32766, 6830, 510, 1066, 65534, 26, 1567,... The odd numbers are very rare: 5, 37, 1567,...
The numbers of the form 5*2^2m for m = 0,1,.. are in the sequence because s1 = 6, s2 = (5*(2^(2m+1)-2)+ 30) ==0 (mod 6) => s2/s1 is an integer.

Examples

			5 is in the sequence 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 => 30/6 = 5 is an integer.
		

Crossrefs

Programs

  • Maple
    T:=array(1..2000):U:=array(1..2000):nn:=350000:
    for n from 1 to nn do:
      kk:=1:m:=n:T[kk]:=n:it:=0:
        for i from 1 to nn while(m<>1) do:
         if irem(m,2)=0
          then
           m:=m/2:kk:=kk+1:T[kk]:=m:
          else
          m:=3*m+1:kk:=kk+1:T[kk]:=m:
         fi:
        od:
        s1:=0:s2:=0:
        for j from 1 to kk do:
        if irem(T[j],2)=1
        then
        s1:=s1+T[j]:
        else s2:=s2+T[j]:
        fi:
        od:
        if s1<>0 and floor(s2/s1)=s2/s1
        then
        printf(`%d, `,n):else fi:
      od:
  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&];a:=Select[coll[n],OddQ[#]&];b:=Select[coll[n],EvenQ[#]&];Do[s1=Sum[a[[i]],{i,1,Length[a]}];s2=Sum[b[[j]],{j,1,Length[b]}];If[IntegerQ[s2/s1],Print[n]],{n,1,350000}]
    s2s1Q[n_]:=Module[{coll=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&],s1,s2},s1=Total[ Select[ coll,OddQ]];s2=Total[Select[coll,EvenQ]];IntegerQ[s2/s1]]; Select[Range[330000],s2s1Q] (* Harvey P. Dale, Feb 26 2024 *)
  • PARI
    isok(n) = {if (n % 2, s1 = n; s2 = 0, s2 = n; s1 = 0); while (n != 1, if (n % 2, n = 3*n+1, n /= 2); if (n % 2, s1 += n, s2 +=n);); s2 % s1 == 0;} \\ Michel Marcus, Jul 09 2016

A277336 Numbers n for which the sum of the odd members and the sum of the even members in the Collatz (3x+1) trajectory are both semiprime.

Original entry on oeis.org

6, 12, 24, 35, 61, 76, 96, 118, 146, 162, 230, 245, 338, 362, 384, 426, 444, 460, 472, 580, 584, 605, 642, 645, 664, 697, 718, 740, 790, 804, 812, 814, 830, 852, 877, 920, 926, 954, 979, 1098, 1178, 1192, 1216, 1332, 1334, 1406, 1415, 1446, 1452, 1454, 1459
Offset: 1

Views

Author

Michel Lagneau, Oct 09 2016

Keywords

Comments

The corresponding pairs of semiprimes are (9, 46), (9, 58), (9, 82), (94, 446), (178, 838), (95, 538), (9, 226), (411, 1894), (20499, 82366), (259, 1366), (493, 2446), (362, 1942), ...

Examples

			6 is in the sequence because the Collatz trajectory is 6 -> 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 => the sum of the odd members is 3 + 5 + 1 = 9 = 3*3 and the sum of the even members is 6 + 10 + 16 + 8 + 4 + 2 = 46 = 2*23.
		

Crossrefs

Programs

  • Mathematica
    coll[n_]:=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&];a:=Select[coll[n],OddQ[#]&];b:=Select[coll[n],EvenQ[#]&];Do[s1=Sum[a[[i]],{i,1,Length[a]}];s2=Sum[b[[j]],{j,1,Length[b]}];If[PrimeOmega[s1]==2&&PrimeOmega[s2]==2,Print[n]],{n,1,1500}]
  • PARI
    is(n)=my(e,o=1); while(n>1, if(n%2, o+=n; n+=2*n+1, e+=n; n/=2)); isprime(e/2) && bigomega(o)==2 \\ Charles R Greathouse IV, Oct 09 2016

A275584 Primes p such that S_e(p-1)/S_o(p-1) is an integer, where S_e(x) is the sum of the even numbers and S_o(x) is the sum of the odd numbers in the Collatz iteration of x.

Original entry on oeis.org

2, 3, 5, 17, 257, 59393, 65537, 331777, 534529, 1299457
Offset: 1

Views

Author

Jaroslav Krizek, Aug 04 2016

Keywords

Comments

Primes p such that A213909(p-1)/A213916(p-1) is an integer.
Primes of the form A274796 + 1.
Fermat primes (A019434) are terms. Also supersequence of A092506 (primes of the form 2^n+1).
Corresponding values of S_e/o(a(n)-1): 0, 2, 6, 30, 510, 1567, 131070, ...

Examples

			Prime 59393 is a term because S_e/o(59392) = A213909(59392)/A213916(59392) = 119092/76 = 1567.
		

Crossrefs

Programs

  • Magma
    [n+1: n in [A274796(m)] | IsPrime(n+1)]
    
  • Magma
    e:= [&+[not IsOdd(h) select h else 0: h in [k eq 1 select n else IsOdd(Self(k-1)) and not IsOne(Self(k-1)) select 3*Self(k-1)+1 else Self(k-1) div 2: k in [1..5*n]]]: n in [1..1000]]; o:= [&+[IsOdd(h) select h else 0: h in [k eq 1 select n else IsOdd(Self(k-1)) and not IsOne(Self(k-1)) select 3*Self(k-1)+1 else Self(k-1) div 2: k in [1..5*n]]]: n in [1..1000]]; [n+1: n in [1..1000] | IsPrime(n+1) and e[n] mod o[n] eq 0]
  • Mathematica
    Select[Prime@ Range[10^5], IntegerQ[Divide @@ Map[Total, TakeDrop[#, LengthWhile[#, EvenQ]]]] &@ SortBy[#, OddQ] &@ NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, # - 1, # > 1 &] &] (* Michael De Vlieger, Oct 15 2018 *)

Formula

S_e/o(A092506(n)-1) = A033493(A092506(n))-1.

Extensions

More terms from Michael De Vlieger, Oct 15 2018.
Showing 1-6 of 6 results.