|
|
A028233
|
|
If n = p_1^e_1 * ... * p_k^e_k, p_1 < ... < p_k primes, then a(n) = p_1^e_1, with a(1) = 1.
|
|
27
|
|
|
1, 2, 3, 4, 5, 2, 7, 8, 9, 2, 11, 4, 13, 2, 3, 16, 17, 2, 19, 4, 3, 2, 23, 8, 25, 2, 27, 4, 29, 2, 31, 32, 3, 2, 5, 4, 37, 2, 3, 8, 41, 2, 43, 4, 9, 2, 47, 16, 49, 2, 3, 4, 53, 2, 5, 8, 3, 2, 59, 4, 61, 2, 9, 64, 5, 2, 67, 4, 3, 2, 71, 8, 73, 2, 3, 4, 7, 2, 79, 16, 81, 2, 83, 4, 5, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
If n=10, then a(10) = 2 since 10 = 2^1*5^1.
If n=16, then a(16) = 16 since 16 = 2^4.
If n=29, then a(29) = 29 since 29 = 29^1.
(End)
|
|
MAPLE
|
local spf, pf;
if n = 1 then
return 1 ;
end if;
for pf in ifactors(n)[2] do
if pf[1] = spf then
return pf[1]^pf[2] ;
end if;
end do:
# second Maple program:
a:= n-> `if`(n=1, 1, (i->i[1]^i[2])(sort(ifactors(n)[2])[1])):
|
|
MATHEMATICA
|
a[n_] := Power @@ First[ FactorInteger[n]]; Table[a[n], {n, 1, 86}] (* Jean-François Alcover, Dec 01 2011 *)
|
|
PROG
|
(Haskell)
a028233 = head . a141809_row
(Python)
from sympy import factorint
def a(n):
f = factorint(n)
(Scheme)
;; Naive implementation of A020639 is given under that entry. All of these functions could be also defined with definec to make them faster on the later calls. See http://oeis.org/wiki/Memoization#Scheme
(define (A028233 n) (if (< n 2) n (let ((lpf (A020639 n))) (let loop ((m lpf) (n (/ n lpf))) (cond ((not (zero? (modulo n lpf))) m) (else (loop (* m lpf) (/ n lpf)))))))) ;; Antti Karttunen, May 29 2017
(GAP) List(List(List(List([1..10^3], Factors), Collected), i -> i[1]), j -> j[1]^j[2]); # Muniru A Asiru, Jan 27 2018
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,nice,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|