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.

A249740 The largest prime whose square divides n, 1 if n is squarefree.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 2, 1, 1, 1, 2, 5, 1, 3, 2, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 2, 7, 5, 1, 2, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 3, 2, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 5, 2, 1, 1, 1, 2, 3, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 2, 1, 1, 1, 2, 1, 7, 3, 5, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 2
Offset: 1

Views

Author

Antti Karttunen, Nov 04 2014

Keywords

Comments

A249739 gives the corresponding smallest prime.

Crossrefs

Differs from A071773 and A249739 for the first time at n=36, where a(36) = 3, while A249739(36) = 2 and A071773(36) = 6.

Programs

  • Mathematica
    a[n_] := If[(f = Select[FactorInteger[n], Last[#] > 1 &]) == {}, 1, f[[-1, 1]]]; Array[a, 100] (* Amiram Eldar, Feb 11 2021 *)
    Table[If[SquareFreeQ[n],1,Select[FactorInteger[n],#[[2]]>1&][[-1,1]]],{n,120}] (* Harvey P. Dale, Feb 28 2021 *)
  • Scheme
    (define (A249740 n) (let loop ((n n) (p (A006530 n))) (cond ((= 1 n) n) ((zero? (modulo n (* p p))) p) (else (loop (/ n p) (A006530 (/ n p)))))))
    ;; Alternative version which is based on the given recurrence, and utilizes the memoizing definec-macro from Antti Karttunen's IntSeq-library:
    (definec (A249740 n) (cond ((= n 1) n) ((zero? (A241917 n)) (A006530 n)) (else (A249740 (A052126 n)))))

Formula

a(1) = 1, and for n > 1, if A241917(n) = 0 [i.e., n is a term of A070003], a(n) = A006530(n), otherwise a(n) = a(A052126(n)).
a(n) = A006530(A003557(n)). - Amiram Eldar, Feb 11 2021