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.

A284252 a(n) = smallest prime dividing n which is larger than the square of smallest prime dividing n, or 1 if no such prime exists, a(1) = 1.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 24 2017

Keywords

Examples

			For n=10 = 2*5, the smallest prime divisor > 2^2 is 5, thus a(10) = 5.
For n=15 = 3*5, there are no prime divisors > 3^2, thus a(15) = 1.
For n=165 = 3*5*11, the smallest prime divisor > 3^2 is 11, thus a(165) = 11.
		

Crossrefs

Cf. A251726 (gives the positions of ones after the initial a(1) = 1), A251727 (positions of terms > 1).

Programs

  • Mathematica
    a[n_] := Block[{p = First /@ FactorInteger[n]}, SelectFirst[p, # > p[[1]]^2 &, 1]]; Array[a, 120] (* Giovanni Resta, Mar 24 2017 *)
  • PARI
    a(n) = if(n==1, return(1), my(f=factor(n)[, 1]); s = f[1]; for(i=2,#f, if(f[i]>s^2, return(f[i]))); return(1)) \\ David A. Corneth, Mar 24 2017
    
  • Python
    from sympy import primefactors
    def a(n):
        for i in primefactors(n):
            if i>min(primefactors(n))**2: return i
        return 1
    print([a(n) for n in range(1, 151)]) # Indranil Ghosh, Mar 24 2017
  • Scheme
    (define (A284252 n) (let ((spf1 (A020639 n))) (let loop ((n (/ n spf1))) (let ((spf2 (A020639 n))) (cond ((= 1 spf2) 1) ((> spf2 (* spf1 spf1)) spf2) (else (loop (/ n spf2))))))))
    

Formula

a(n) = A020639(A284254(n)).
a(k) > 1 iff k is in A251727. - David A. Corneth, Mar 25 2017