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

A014673 Smallest prime factor of greatest proper divisor of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 2, 3, 5, 1, 2, 1, 7, 5, 2, 1, 3, 1, 2, 7, 11, 1, 2, 5, 13, 3, 2, 1, 3, 1, 2, 11, 17, 7, 2, 1, 19, 13, 2, 1, 3, 1, 2, 3, 23, 1, 2, 7, 5, 17, 2, 1, 3, 11, 2, 19, 29, 1, 2, 1, 31, 3, 2, 13, 3, 1, 2, 23, 5, 1, 2, 1, 37, 5, 2, 11, 3, 1, 2, 3, 41, 1, 2, 17, 43, 29, 2, 1, 3, 13, 2, 31, 47
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 24 2003

Keywords

Comments

For n > 1: a(n) = 1 iff n is prime; a(A001358(n)) = A084127(n); a(A025475(n)) = A020639(A025475(n)). [corrected by Peter Munn, Feb 19 2017]
When n is composite, this is the 2nd factor when n is written as a product of primes in nondecreasing order. For example, 12 = 2*2*3, so a(12) = 2. - Peter Munn, Feb 19 2017
For all sufficiently large n the median value of a(1), a(2), ... a(n) is A281889(2) = 7. - Peter Munn, Jul 12 2019

Crossrefs

Programs

  • Mathematica
    PrimeFactors[ n_ ] := Flatten[ Table[ # [ [ 1 ] ], {1} ] & /@ FactorInteger[ n ] ]; f[ n_ ] := Block[ {gpd = Divisors[ n ][ [ -2 ] ]}, If[ gpd == 1, 1, PrimeFactors[ gpd ][ [ 1 ] ] ] ]; Table[ If[ n == 1, 1, f[ n ] ], {n, 1, 95} ]
    (* Second program: *)
    Table[If[Or[PrimeQ@ n, n == 1], 1, FactorInteger[n/SelectFirst[Prime@ Range@ PrimePi[Sqrt@ n], Divisible[n, #] &]][[1, 1]] ], {n, 94}] (* Michael De Vlieger, Aug 14 2017 *)
  • PARI
    lpf(n)=if(n>1,factor(n)[1,1],1)
    a(n)=lpf(n/lpf(n)) \\ Charles R Greathouse IV, May 09 2013
    
  • PARI
    a(n)=if(n<4||isprime(n),return(1)); my(f=factor(n)); if(f[1,2]>1, f[1,1], f[2,1]) \\ Charles R Greathouse IV, May 09 2013
    
  • Scheme
    (define (A014673 n) (A020639 (/ n (A020639 n)))) ;; Code for A020639 given under that entry - Antti Karttunen, Aug 12 2017

Formula

a(n) = A020639(A032742(n)).
A117357(n) = A020639(A054576(n)); A117358(n) = A032742(A054576(n)) = A054576(n)/A117357(n). - Reinhard Zumkeller, Mar 10 2006
If A001222(n) >= 2, a(n) = A027746(n,2), otherwise a(n) = 1. - Peter Munn, Jul 13 2019

A085392 a(n) = largest prime divisor of n, or 1 if n is 1 or a prime.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 2, 3, 5, 1, 3, 1, 7, 5, 2, 1, 3, 1, 5, 7, 11, 1, 3, 5, 13, 3, 7, 1, 5, 1, 2, 11, 17, 7, 3, 1, 19, 13, 5, 1, 7, 1, 11, 5, 23, 1, 3, 7, 5, 17, 13, 1, 3, 11, 7, 19, 29, 1, 5, 1, 31, 7, 2, 13, 11, 1, 17, 23, 7, 1, 3, 1, 37, 5, 19, 11, 13, 1, 5, 3, 41, 1, 7, 17, 43, 29, 11, 1, 5, 13
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a085392 = a006530 . a032742  -- Reinhard Zumkeller, Oct 03 2012
    
  • Maple
    A085392 := proc(n) max( op(numtheory[divisors](n) minus {n})) ; A006530(%) ;
    end proc:
    seq(A085392(n),n=1..50) ; # R. J. Mathar, Jun 26 2011
  • Mathematica
    PrimeFactors[n_] := Flatten[ Table[ # [[1]], {1}] & /@ FactorInteger[n]]; f[n_] := Block[{gpd = Divisors[n][[ -2]]}, If[gpd == 1, 1, PrimeFactors[gpd][[ -1]] ]]; Table[ If[n == 1, 1, f[n]], {n, 1, 95}]
    Join[{1},Table[FactorInteger[Divisors[n][[-2]]][[-1,1]],{n,2,120}]] (* Harvey P. Dale, Jul 02 2019 *)
    a[n_] := If[CompositeQ[n], FactorInteger[n][[-1, 1]], 1]; Array[a, 100] (* Amiram Eldar, Jun 19 2022 *)
  • PARI
    gpd(n) = if (n==1, 1, n/factor(n)[1,1]);
    gpf(n) = if (n==1, 1, vecmax(factor(n)[,1]));
    a(n) = gpf(gpd(n)); \\ Michel Marcus, Apr 08 2018

Formula

a(n) = A006530(A032742(n)). - R. J. Mathar, Jun 26 2011

Extensions

Definition corrected by N. J. A. Sloane, Jul 02 2019. Also deleted an incorrect comment.
Showing 1-2 of 2 results.