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 255 results. Next

A066903 Primes in A006577.

Original entry on oeis.org

7, 2, 5, 3, 19, 17, 17, 7, 7, 23, 5, 13, 13, 109, 29, 11, 11, 11, 19, 19, 19, 19, 107, 107, 17, 17, 17, 17, 113, 113, 113, 7, 41, 41, 103, 103, 23, 23, 23, 23, 23, 23, 23, 67, 31, 31, 31, 31, 31, 31, 13, 13, 13, 13, 101, 101, 13, 13, 127, 83, 127, 47, 47, 109, 47, 109, 109
Offset: 1

Views

Author

K. B. Subramaniam (kb_subramaniambalu(AT)yahoo.com), Dec 20 2001

Keywords

Examples

			a(1) = 7 because the first prime in A006577 is A006577(3) = 7.
		

Crossrefs

Cf. A006577.

Programs

  • Maple
    N:= 1000; # to get the first N terms
    Collatz:= proc(n) option remember;
    if n::even then 1+Collatz(n/2)
    else 1+Collatz(3*n+1)
    fi
    end proc;
    Collatz(1):= 0;
    count:= 0;
    for i from 1 while count < N do
      x:= Collatz(i);
      if isprime(x) then count:= count+1; A[count]:= x fi;
    od:
    seq(A[i],i=1..N); # Robert Israel, Jun 01 2014
  • Mathematica
    M = 100;
    Collatz[n_] := Collatz[n] = If[EvenQ[n], 1+Collatz[n/2], 1+Collatz[3n+1]];
    Collatz[1] = 0;
    count = 0;
    For[i = 1, count < M, i++, x = Collatz[i]; If[PrimeQ[x], count = count+1; a[count] = x]];
    Array[a, M] (* Jean-François Alcover, Mar 26 2019, after Robert Israel *)

Extensions

More terms from Sascha Kurz, Mar 23 2002
Offset corrected by Robert Israel, Jun 01 2014

A346592 Numbers k such that A006577(k^2) sets a new record.

Original entry on oeis.org

2, 3, 5, 7, 10, 11, 22, 35, 45, 49, 51, 77, 123, 143, 269, 419, 429, 765, 1011, 1395, 1989, 2165, 3335, 3827, 7179, 9005, 18010, 36020, 41453, 82906, 92099, 184198, 268509, 272767, 469347, 563273, 1126546, 1224197, 2172433, 2303171, 2825329, 5650658, 9295309, 10741519
Offset: 1

Views

Author

Hugo Pfoertner, Jul 28 2021

Keywords

Crossrefs

Programs

  • PARI
    a6577(n0)={my(n=n0,k=0);while(n>1,k++;n=if(n%2,3*n+1,n/2));k};
    a346592(limit)={msteps=0;for(k=1,limit,my(m=a6577(k^2));if(m>msteps,print1(k,", ");msteps=m))};
    a346592(1500000)

A346593 Numbers k such that A006577(k^3) sets a new record.

Original entry on oeis.org

2, 3, 6, 7, 14, 15, 25, 41, 45, 71, 79, 153, 233, 235, 470, 503, 707, 741, 1482, 2964, 3039, 3581, 7162, 14324, 27337, 54674, 61683, 123366, 168159, 254251, 302839, 605678, 622699, 947173, 1618687, 3237374, 6474748, 10995401, 13042083, 21767875, 43535750, 48584565
Offset: 1

Views

Author

Hugo Pfoertner, Jul 28 2021

Keywords

Crossrefs

Programs

  • Mathematica
    s[n_]:=s[n]=(i=0;r=n;While[r!=1,i++;If[EvenQ@r,r=r/2,r=r*3+1]];i);
    lst={};max=1;Do[t=s[k^3];If[t>max,AppendTo[lst,k];max=t],{k,10^4}];lst (* Giorgos Kalogeropoulos, Jul 28 2021 *)
  • PARI
    a6577(n0)={my(n=n0,k=0);while(n>1,k++;n=if(n%2,3*n+1,n/2));k};
    a346593(limit)={msteps=0;for(k=1,limit,my(m=a6577(k^3));if(m>msteps,print1(k,", ");msteps=m))};
    a346593(1000000)

A066906 Places n where A006577(n) is a prime number.

Original entry on oeis.org

3, 4, 5, 8, 9, 14, 15, 20, 21, 25, 32, 34, 35, 41, 43, 48, 52, 53, 56, 58, 60, 61, 62, 63, 88, 90, 92, 93, 108, 109, 110, 128, 135, 139, 142, 143, 144, 148, 149, 152, 154, 162, 163, 167, 172, 173, 174, 177, 178, 179, 192, 208, 212, 213, 214, 215, 226, 227, 231, 233
Offset: 1

Views

Author

K. B. Subramaniam (kb_subramaniambalu(AT)yahoo.com), Dec 20 2001

Keywords

Crossrefs

Cf. A006577.

Extensions

More terms from Sascha Kurz, Mar 23 2002

A127930 Terms of A127928 that are prime in A006577.

Original entry on oeis.org

3, 43, 109, 163, 307, 439, 541, 619, 937, 1069, 1087, 1297, 1303, 1321, 1609, 1621, 1627, 1657, 1783, 1861, 2053, 2251, 2293, 2311, 2347, 2647, 2689, 3067, 3121, 3319, 3373, 3457, 3499, 3511, 3517, 3607, 3637, 3769, 4051, 4057, 4219, 4363, 4561, 4723, 4813, 4903
Offset: 1

Views

Author

Gary W. Adamson, Feb 07 2007

Keywords

Comments

Through a(9) the terms have the following number of 3x+1 problem steps: 7, 29, 113, 23, 37, 53, 43, 131, 173.

Examples

			3 is in the set A127930 since the iterative trajectory of 3 has 7 steps: (10, 5, 16, 8, 4, 2, 1) and 7 is prime.
		

Crossrefs

Formula

A127928 = numbers that are both pure hailstone (Collatz) and prime. A127930 = the subset having prime steps to reach 1; given the Collatz rule C(n) = {3n+1, n odd; n/2 if n is even}.

Extensions

More terms from Amiram Eldar, Feb 28 2020

A346591 Composite numbers k such that A006577(k) sets a new record.

Original entry on oeis.org

4, 6, 9, 18, 25, 27, 54, 108, 129, 171, 231, 327, 649, 703, 871, 1161, 2223, 2463, 2919, 3711, 6171, 10971, 13255, 17647, 23529, 26623, 34239, 35655, 52527, 77031, 106239, 142587, 156159, 216367, 230631, 410011, 511935, 626331, 837799, 1117065, 1501353, 1723519
Offset: 1

Views

Author

Hugo Pfoertner, Jul 28 2021

Keywords

Crossrefs

A006877 is the union of A244638 and this sequence.

Programs

  • Mathematica
    s[n_]:=s[n]=(i=0;r=n;While[r!=1,i++;If[EvenQ@r,r=r/2,r=r*3+1]];i);
    lst={};max=1;Do[If[!PrimeQ@k,t=s[k];If[t>max,AppendTo[lst,k];max=t]],{k,10^4}];lst (* Giorgos Kalogeropoulos, Jul 28 2021 *)
  • PARI
    a6577(n0)={my(n=n0,k=0);while(n>1,k++;n=if(n%2,3*n+1,n/2));k};
    a346591(limit)={msteps=0;forcomposite(c=4,limit,my(m=a6577(c));if(m>msteps,print1(c,", ");msteps=m))};
    a346591(2000000)

A058633 Partial sums of A006577.

Original entry on oeis.org

0, 1, 8, 10, 15, 23, 39, 42, 61, 67, 81, 90, 99, 116, 133, 137, 149, 169, 189, 196, 203, 218, 233, 243, 266, 276, 387, 405, 423, 441, 547, 552, 578, 591, 604, 625, 646, 667, 701, 709, 818, 826, 855, 871, 887, 903, 1007, 1018, 1042, 1066, 1090, 1101, 1112, 1224
Offset: 1

Views

Author

Felix Goldberg (felixg(AT)tx.technion.ac.il), Dec 26 2000

Keywords

Examples

			a(3) = A006577(1) + A006577(2) + A006577(3) = 0 + 1 + 7 = 8.
		

Crossrefs

Programs

  • Mathematica
    A006577[n_] := Length[NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]] - 1;
    Accumulate[Array[A006577, 100]] (* Paolo Xausa, Oct 01 2024 *)
  • PARI
    A006577(n)=if(n<0, 0, s=n; c=0; while(s>1, s=if(s%2, 3*s+1, s/2); c++); c)
    s=0; vector(100,n, s+=A006577(n) ) \\ Charles R Greathouse IV, May 11 2015

Formula

a(n) = Sum_{i=0..n} A006577(i).

A078418 Numbers k such that h(k) = h(k-1) + h(k-2), where h(k) = A006577(k) + 1 is the length of the sequence {k, f(k), f(f(k)), ...., 1} in the Collatz (or 3x + 1) problem. (The earliest "1" is meant.)

Original entry on oeis.org

6, 22, 97, 108, 114, 495, 559, 2972, 3092, 3124, 3147, 3154, 3329, 3367, 3483, 3643, 3711, 3748, 3756, 3982, 4009, 4767, 17435, 17782, 17796, 17863, 17892, 17897, 18079, 18139, 18422, 18580, 18644, 18688, 18784, 18804, 18952, 19739, 19868
Offset: 1

Views

Author

Joseph L. Pe, Dec 29 2002

Keywords

Comments

Recall that f(n) = n/2 if n is even; = 3n + 1 if n is odd.

Examples

			n, f(n), f(f(n)), ...., 1 for n = 22, 21, 20, respectively, are: 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1; 21, 64, 32, 16, 8, 4, 2, 1; 20, 10, 5, 16, 8, 4, 2, 1. Hence h(22) = 16 = 8 + 8 = h(21) + h(20) and 22 belongs to the sequence.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := If[EvenQ[n], n/2, 3n+1]; h[n_] := Module[{a, i}, i=n; a=1; While[i>1, a++; i=f[i]]; a]; Select[Range[3, 19900], h[ # ]==h[ #-1]+h[ #-2]&]

Extensions

Extended by Robert G. Wilson v, Dec 30 2002
Name clarified by Sean A. Irvine, Jun 29 2025

A287798 Least k such that A006667(k)/A006577(k) = 1/n.

Original entry on oeis.org

159, 6, 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 40960, 81920, 163840, 327680, 655360, 1310720, 2621440, 5242880, 10485760, 20971520, 41943040, 83886080, 167772160, 335544320, 671088640, 1342177280, 2684354560, 5368709120, 10737418240
Offset: 3

Views

Author

Michel Lagneau, Jun 01 2017

Keywords

Comments

A006667: number of tripling steps to reach 1 in '3x+1' problem.
A006577: number of halving and tripling steps to reach 1 in '3x+1' problem.
a(n) = {159, 6} union {A020714}.

Examples

			a(3) = 159 because A006667(159)/A006577(159) = 18/54 = 1/3.
		

Crossrefs

Cf. A006577, A006666, A006667. Essentially the same as A020714, A084215, A146523 and A257113.

Programs

  • Maple
    nn:=10^12:
    for n from 3 to 35 do:
    ii:=0:
    for k from 2 to 10^6 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 n*s1=s1+s2
         then
         ii:=1: printf(`%d, `,k):
         else
        fi:
    od:od:
  • Mathematica
    f[u_]:=Module[{a=u,k=0},While[a!=1,k++;If[EvenQ[a],a=a/2,a=a*3+1]];k];Table[f[u],{u,10^7}];g[v_]:=Count[Differences[NestWhileList[If[EvenQ[#],#/2,3#+1]&,v,#>1&]],_?Positive];Table[g[v],{v,10^7}];Do[k=3;While[g[k]/f[k]!=1/n,k++];Print[n," ",k],{n,3,35}]
  • PARI
    a(n) = if(n < 5, [0,0,159,6][n], 5<<(n-5)) \\ David A. Corneth, Jun 01 2017
    
  • PARI
    Vec(x^3*(159 - 312*x - 7*x^2) / (1 - 2*x) + O(x^50)) \\ Colin Barker, Jun 01 2017

Formula

For n >= 5, a(n) = 5*2^n/32. - David A. Corneth, Jun 01 2017
From Colin Barker, Jun 01 2017: (Start)
G.f.: x^3*(159 - 312*x - 7*x^2) / (1 - 2*x).
a(n) = 2*a(n-1) for n>5.
(End)

A337150 Nonnegative integers in the order in which they appear first in A006577.

Original entry on oeis.org

0, 1, 7, 2, 5, 8, 16, 3, 19, 6, 14, 9, 17, 4, 12, 20, 15, 10, 23, 111, 18, 106, 26, 13, 21, 34, 109, 29, 104, 11, 24, 112, 32, 107, 27, 102, 22, 115, 35, 110, 30, 92, 105, 118, 25, 87, 38, 100, 113, 69, 33, 95, 46, 108, 121, 28, 41, 90, 103, 116, 36, 85, 54
Offset: 1

Views

Author

Alois P. Heinz, Jan 27 2021

Keywords

Comments

This is A006577 with duplicates removed.
This is a permutation of the nonnegative integers.

Crossrefs

Programs

  • Maple
    collatz:= proc(n) option remember; `if`(n=1, 0,
       1 + collatz(`if`(n::even, n/2, 3*n+1)))
    end:
    b:= proc() 0 end:
    g:= proc(n) option remember; local t;
         `if`(n=1, 0, g(n-1));
          t:= collatz(n); b(t):= b(t)+1
        end:
    h:= proc(n) option remember; local k; for k
          from 1+h(n-1) while g(k)>1 do od; k
        end: h(0):=0:
    a:= n-> collatz(h(n)):
    seq(a(n), n=1..100);
  • Mathematica
    collatz[n_] := collatz[n] = If[n==1, 0,
       1 + collatz[If[EvenQ[n], n/2, 3n+1]]];
    b[_] = 0;
    g[n_] := g[n] = Module[{t}, If[n==1, 0, g[n-1]];
       t = collatz[n]; b[t] = b[t]+1];
    h[n_] := h[n] = Module[{k}, For[k = 1+h[n-1],
       g[k]>1, k++]; k]; h[0] = 0;
    a[n_] := a[n] = collatz[h[n]];
    Array[a, 100] (* Jean-François Alcover, Jan 30 2021, after Alois P. Heinz *)

Formula

a(n) = A006577(A337149(n)).
a(n) = A006577(n) for 1 <= n <= 12.
Showing 1-10 of 255 results. Next