Ruud H.G. van Tol on Sun, 19 Dec 2021 15:24:30 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: factorint_as_string()
- From: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Date: Sun, 19 Dec 2021 15:24:15 +0100
- Delivery-date: Sun, 19 Dec 2021 15:24:30 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=isolution.nl; s=soverin; t=1639923859; bh=sfkL3Lio1VI9Y5WbKrg/Nu9KjbrxxWm0SnCNXkHv/0k=; h=Date:To:From:Subject:From; b=lpvYi0Uop/REc1K4vIwCnC6AN8nRuXgdiUhO5hCup6Ch7P9iS2Qsq1cBbidLapHEi E2vw8fqjPYXaj0v7V8sAlgUOF/rEDcQMC+gltvOcHAww+oG+chFz1/9DvrKSeNT4XA AIss7iqbGE2Gqe+n9yjCq+e5P2/cIVqou5/9NnDL3fWi36pBMmIQLhiPqDnPfx9H2L qKTFGpsw1HIudmWRx6obST6ffcvnAXgazIn/eNaC8yzLgfeTWFIrH2VO6JTv3ar7G0 MFQheEKi3joLNNtPV6QFTecCfEnPlUastbyLV4W/9HZMEIxQwlvPr+k0SuQrFq9UUP XPLvuduwtfCqg==
sf() = my(v=Vec(factorint(n)~)); if(!#v, v=Vec([1;1])); for(i=1, #v,
v[i]=if(v[i][2]>1, strjoin(v[i],"^"), v[i][1])); strjoin(["(",
strjoin(v," * "), ")"])
Example:
? sf(3087)
%527 = "(3^2 * 7^3)"
-- Ruud