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

A055509 Number of odd primes in sequence obtained in 3x+1 (or Collatz) problem starting at n.

Original entry on oeis.org

0, 0, 2, 0, 1, 2, 5, 0, 5, 1, 4, 2, 2, 5, 3, 0, 3, 5, 6, 1, 0, 4, 3, 2, 6, 2, 24, 5, 5, 3, 23, 0, 6, 3, 2, 5, 6, 6, 10, 1, 24, 0, 7, 4, 3, 3, 22, 2, 6, 6, 5, 2, 2, 24, 23, 5, 7, 5, 10, 3, 4, 23, 19, 0, 6, 6, 8, 3, 2, 2, 21, 5, 24, 6, 1, 6, 5, 10, 10, 1, 4, 24, 23, 0, 0, 7, 8, 4, 9, 3, 19, 3, 2, 22, 19
Offset: 1

Views

Author

G. L. Honaker, Jr., Jun 30 2000

Keywords

Crossrefs

Programs

  • Haskell
    a055509 n = sum $ map a010051 $ takeWhile (> 2) $ iterate a006370 n -- Reinhard Zumkeller, Oct 08 2011
    
  • Maple
    g:= proc(n) option remember;
       local x;
       x:= 3*n+1;
       x:= x/2^padic:-ordp(x,2);
       if isprime(n) then procname(x)+1 else procname(x) fi
    end proc:
    g(1):= 0:
    seq(g(n/2^padic:-ordp(n,2)),n=1..100); # Robert Israel, Dec 05 2017
  • Mathematica
    Join[{0}, Table[Count[NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &], ?PrimeQ] - 1, {n, 2, 94}]] (* _Jayanta Basu, Jun 15 2013 *)
  • PARI
    A078350(n,c=0)={while(1>=valuation(n,2), isprime(n)&&c++; n=n*3+1);c} \\ M. F. Hasler, Dec 05 2017

Formula

a(n) = A078350(n) - 1 for n > 1.
a(A196871(n)) = 0. - Reinhard Zumkeller, Oct 08 2011
From Robert Israel, Dec 05 2017: (Start)
If n is odd, a(n) = a(3*n+1) + A010051(n).
If n is even, a(n) = a(n/2). (End)

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Aug 09 2001

A087272 a(n) is the largest prime number in 3x+1 trajectory initiated at n.

Original entry on oeis.org

2, 5, 2, 5, 5, 17, 2, 17, 5, 17, 5, 13, 17, 53, 2, 17, 17, 29, 5, 2, 17, 53, 5, 29, 13, 1619, 17, 29, 53, 1619, 2, 29, 17, 53, 17, 37, 29, 101, 5, 1619, 2, 43, 17, 17, 53, 1619, 5, 37, 29, 29, 13, 53, 1619, 1619, 17, 43, 29, 101, 53, 61, 1619, 1619, 2, 37, 29, 101, 17, 13, 53
Offset: 2

Views

Author

Labos Elemer, Sep 18 2003

Keywords

Crossrefs

Programs

  • Mathematica
    c[x_] := (1-Mod[x, 2])*(x/2)+Mod[x, 2]*(3*x+1); c[1]=1; fpl[x_] := Delete[FixedPointList[c, x], -1] ofp[x_] := Part[fpl[x], Flatten[Position[PrimeQ[fpl[x]], True]]] Table[Max[ofp[w]], {w, 1, 256}]
    Table[Max[Select[NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#>1&],PrimeQ]],{n,2,70}] (* Harvey P. Dale, Feb 27 2023 *)
  • PARI
    a(n) = my (mx=2); while (n>1, if (isprime(n), mx=max(mx,n)); n=if (n%2, 3*n+1, n/2)); mx \\ Rémy Sigrist, Oct 08 2018

Extensions

Offset corrected by Rémy Sigrist, Oct 08 2018

A299963 a(n) = greatest prime factor of the terms in the Collatz sequence starting at n; a(1) = 1.

Original entry on oeis.org

1, 2, 5, 2, 5, 5, 17, 2, 17, 5, 17, 5, 13, 17, 53, 2, 17, 17, 29, 5, 7, 17, 53, 5, 29, 13, 1619, 17, 29, 53, 1619, 2, 29, 17, 53, 17, 37, 29, 101, 5, 1619, 7, 43, 17, 17, 53, 1619, 5, 37, 29, 29, 13, 53, 1619, 1619, 17, 43, 29, 101, 53, 61, 1619, 1619, 2, 37
Offset: 1

Views

Author

Rémy Sigrist, Feb 22 2018

Keywords

Comments

The value 3 cannot appear in this sequence.
The value 1619 appears 1654 times among the first 10000 terms; this is visible as a dashed horizontal line in the corresponding scatterplot.
The most frequent values among the first 10000000 terms are:
Value Number of occurrences among the first 10000000 terms
------- ---------------------------------------------------
283763 16934
2017817 15701
1619 15274
55667 14706
2717873 9913

Crossrefs

Programs

  • Mathematica
    Table[Max[FactorInteger[#][[-1,1]]&/@NestWhileList[If[EvenQ[#],#/2,3#+1]&, n,#>1&]], {n,70}] (* Harvey P. Dale, Jun 22 2020 *)
  • PARI
    a(n) = my (g=1); while (n>1, my (f=factor(n)); g=max(g,f[#f~,1]); n=if (n%2, 3*n+1, n/2)); return (g)

Formula

a(n) = A006530(A178168(n)).
a(2*n) = a(n) for any n > 1.
a(2^k) = 2 for any k > 0.
Showing 1-3 of 3 results.