Re: Easiest Mathematica algorhitm needed
- To: mathgroup at smc.vnet.net
- Subject: [mg92816] Re: [mg92793] Easiest Mathematica algorhitm needed
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Tue, 14 Oct 2008 04:56:24 -0400 (EDT)
- References: <gcq09i$c30$1@smc.vnet.net> <200810120835.EAA08892@smc.vnet.net> <200810131020.GAA14406@smc.vnet.net>
Artur wrote: > Dear Mathematica Gurus, > Who know which Matrhematica function uses to separate square free part > of number. > e.g. > In[1]: Table[Sqrt[n!], {n, 1, 10}] > Out[1]: {1, Sqrt[2], Sqrt[6], 2 Sqrt[6], 2 Sqrt[30], 12 Sqrt[5], 12 > Sqrt[35], > 24 Sqrt[70], 72 Sqrt[70], 720 Sqrt[7]} > What to do to take squre-free parts: > {1, 2, 6, 6, 30, 5, 35, 70, 70, 7} > or square parts > {1, 1, 1, 2, 2, 12, 12, 24, 72, 720} > Best wishes > Artur You'll need to factor the number, then use the exponents to figure out square parts or square free parts, then find the remaining part from that. Here is one way to do this. squareAndSquareFreeParts[n_Integer] := {#,n/#^2}& [Apply[Times,Map[#[[1]]^Floor[#[[2]]/2]&,FactorInteger[n]]]] Daniel Lichtblau Wolfram Research
- References:
- Re: Executing external notebook
- From: Peter Pein <petsie@dordos.net>
- Easiest Mathematica algorhitm needed
- From: Artur <grafix@csl.pl>
- Re: Executing external notebook