login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A249740 The largest prime whose square divides n, 1 if n is squarefree. 6

%I #16 Feb 28 2021 16:12:34

%S 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,

%T 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,

%U 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

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

%C A249739 gives the corresponding smallest prime.

%H Antti Karttunen, <a href="/A249740/b249740.txt">Table of n, a(n) for n = 1..10000</a>

%F 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)).

%F a(n) = A006530(A003557(n)). - _Amiram Eldar_, Feb 11 2021

%t a[n_] := If[(f = Select[FactorInteger[n], Last[#] > 1 &]) == {}, 1, f[[-1, 1]]]; Array[a, 100] (* _Amiram Eldar_, Feb 11 2021 *)

%t Table[If[SquareFreeQ[n],1,Select[FactorInteger[n],#[[2]]>1&][[-1,1]]],{n,120}] (* _Harvey P. Dale_, Feb 28 2021 *)

%o (Scheme)

%o (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)))))))

%o ;; Alternative version which is based on the given recurrence, and utilizes the memoizing definec-macro from _Antti Karttunen_'s IntSeq-library:

%o (definec (A249740 n) (cond ((= n 1) n) ((zero? (A241917 n)) (A006530 n)) (else (A249740 (A052126 n)))))

%Y Cf. A003557, A005117, A013929, A006530, A052126, A070003, A241917, A249718.

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

%K nonn

%O 1,4

%A _Antti Karttunen_, Nov 04 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 04:14 EDT 2024. Contains 371918 sequences. (Running on oeis4.)