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.

A055510 Largest odd prime in sequence obtained in 3x+1 (or Collatz) problem starting at n, or 0 if no such prime is found.

Original entry on oeis.org

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

Views

Author

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

Keywords

Crossrefs

Programs

  • Mathematica
    op[n_]:=Module[{lst=NestWhileList[If[EvenQ[#],#/2,3#+1]&,n,#!=1&],m}, m= Max[Select[ lst,PrimeQ]];If[m<3,0,m]]; Array[op,70] (* Harvey P. Dale, Apr 30 2011 *)

Extensions

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

A087274 Prime index of the largest prime factor of 3*prime(n)+1.

Original entry on oeis.org

4, 3, 1, 5, 7, 3, 6, 10, 4, 5, 15, 4, 11, 6, 20, 3, 24, 9, 26, 28, 5, 7, 3, 19, 21, 8, 11, 9, 13, 7, 43, 45, 27, 8, 4, 49, 17, 4, 54, 6, 57, 7, 13, 10, 12, 9, 66, 19, 11, 14, 4, 72, 42, 10, 44, 22, 26, 12, 6, 47, 7, 5, 89, 91, 15, 7, 20, 9, 98, 32, 16, 5, 10, 4, 104, 9, 21, 35, 14, 63, 12, 22
Offset: 1

Views

Author

Labos Elemer, Sep 18 2003

Keywords

Examples

			n=10: prime(10)=29, max-p-factor(88)=11, pi(11)=5=a(10)<n;
n=11: prime(11)=31, max-p-factor(94)=47, pi(47)=15=a(11)>n;
		

Crossrefs

Programs

  • Mathematica
    ffi[x_] := Flatten[FactorInteger[x]]; ma[x_] := Part[Reverse[ffi[x]], 2]; Table[PrimePi[ma[3*Prime[w]+1]], {w, 1, 100}]
  • PARI
    a(n) = primepi(vecmax(factor(3*prime(n)+1)[, 1])); \\ Michel Marcus, Mar 27 2020

Formula

a(n) = A000720(A006530(1+3*A000040(n))).
a(n) = A000720(A087273(n)). - Amiram Eldar, Jul 12 2024

A087963 Exponent of highest power of 2 dividing 3*prime(n)+1.

Original entry on oeis.org

0, 1, 4, 1, 1, 3, 2, 1, 1, 3, 1, 4, 2, 1, 1, 5, 1, 3, 1, 1, 2, 1, 1, 2, 2, 4, 1, 1, 3, 2, 1, 1, 2, 1, 6, 1, 3, 1, 1, 3, 1, 5, 1, 2, 4, 1, 1, 1, 1, 4, 2, 1, 2, 1, 2, 1, 3, 1, 6, 2, 1, 4, 1, 1, 2, 3, 1, 2, 1, 3, 2, 1, 1, 5, 1, 1, 4, 3, 2, 2, 1, 4, 1, 2, 1, 1, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 3, 1, 3, 1, 2, 1
Offset: 1

Views

Author

Labos Elemer, Sep 18 2003

Keywords

Examples

			For n = 10: p = prime(10) = 29, 3*p + 1 = 88 = 2^3 * 11, a(10) = 3.
		

Crossrefs

Programs

  • Magma
    [Valuation(3*NthPrime(n)+1, 2): n in [1..80]]; // Vincenzo Librandi, Sep 01 2016
    
  • Mathematica
    ffi[x_] := Flatten[FactorInteger[x]]; e2[x_] := Part[[ffi[x]], 2]; Table[e2[3*Prime[w]+1], {w, 1, 100}]
    IntegerExponent[3 * Prime[Range[100]] + 1, 2] (* Amiram Eldar, Jul 12 2024 *)
  • PARI
    a(n) = valuation(3*prime(n)+1, 2); \\ Michel Marcus, Sep 01 2016
    
  • Python
    from sympy import prime
    def A087963(n): return (~(m:=prime(n)*3+1)&m-1).bit_length() # Chai Wah Wu, Jul 10 2022

Formula

a(n) = A007814(3*prime(n)+1).

Extensions

a(1)=0 corrected by Michel Marcus, Sep 01 2016

A320028 a(n) is the first prime encountered when running the Collatz algorithm (halving and tripling steps) on the number n.

Original entry on oeis.org

2, 3, 2, 5, 3, 7, 2, 7, 5, 11, 3, 13, 7, 23, 2, 17, 7, 19, 5, 2, 11, 23, 3, 19, 13, 41, 7, 29, 23, 31, 2, 19, 17, 53, 7, 37, 19, 59, 5, 41, 2, 43, 11, 17, 23, 47, 3, 37, 19, 29, 13, 53, 41, 83, 7, 43, 29, 59, 23, 61, 31, 137, 2, 37, 19, 67, 17, 13, 53, 71, 7, 73, 37, 113, 19, 29, 59, 79, 5, 61, 41, 83, 2, 2, 43, 131
Offset: 2

Views

Author

Alessandro Polcini, Oct 03 2018

Keywords

Comments

A modified version of the halving and tripling Collatz algorithm, which stops as soon as the starting number becomes a prime (instead of stopping when the starting number reaches 1).
The plot of this sequence "completes" or "fills" the lower (empty) part of plot of A270570 and evolves in a similar fashion.

Examples

			a(4) is 2 because 4/2 = 2 and 2 is prime.
a(6) is 3 because 6/2 = 3 and 3 is prime.
a(15) is 23 because 15*3 + 1 = 46; 46/2 = 23 and 23 is prime.
a(18) is 7 because 18/2 = 9; 9*3 + 1 = 28; 28/2 = 14; 14/2 = 7 and 7 is prime.
		

Crossrefs

Programs

  • Java
    int collatzPrime(int i) {
        while(!BigInteger.valueOf(i).isProbablePrime(10) && i > 1) {
            if(i % 2 == 0)
                i /= 2;
            else
                i = 3 * i + 1;
        }
        return i;
    }
    
  • Mathematica
    Array[NestWhile[If[EvenQ@ #, #/2, 3 # + 1] &, #, ! PrimeQ@ # &] &, 86, 2] (* Michael De Vlieger, Nov 07 2018 *)
  • PARI
    a(n) = {while (!isprime(n), if (n % 2, n = 3*n+1, n = n/2);); n;} \\ Michel Marcus, Oct 28 2018

Formula

a(n) <= A087272(n). - Rémy Sigrist, Oct 08 2018

A087964 a(n) is the least prime p such that exponent of highest power of 2 dividing 3p+1 equals n.

Original entry on oeis.org

3, 17, 13, 5, 53, 149, 1237, 1109, 853, 2389, 3413, 17749, 128341, 70997, 251221, 415061, 218453, 2708821, 27088213, 29709653, 3495253, 85284181, 13981013, 39146837, 794121557, 1498764629, 492131669, 626349397, 13779686741
Offset: 1

Views

Author

Labos Elemer, Sep 18 2003

Keywords

Examples

			p = 218453 is the first prime so that 3*p+1 = 655360 = (2^18)*5 has 18 as exponent of 2 in 3p+1, thus a(18) = 218453.
		

Crossrefs

Programs

  • Maple
    f:= proc(n)
       local m,t,p;
       t:= 2^n;
       for m from 1 + 4*(n mod 2) by 6 do
         p:= (t*m-1)/3;
         if isprime(p) then return p fi
       od
    end proc:
    map(f, [$1..100]); # Robert Israel, Nov 18 2017
  • Mathematica
    a[n_] := Module[{m, t = 2^n, p}, For[m = 1 + 4 Mod[n, 2], True, m += 6, p = (t m - 1)/3; If[PrimeQ[p], Return[p]]]];
    Array[a, 100] (* Jean-François Alcover, Aug 28 2020, after Robert Israel *)

Formula

a(n) = A000040(Min{x; A007814(1 + 3*A000040(x)) = n}).

Extensions

More terms from Ray Chandler, Sep 21 2003

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