MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Concatenation of prime factors of numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78646] Re: [mg78599] Concatenation of prime factors of numbers
  • From: Curtis Osterhoudt <cfo at lanl.gov>
  • Date: Fri, 6 Jul 2007 03:20:09 -0400 (EDT)
  • References: <200707050801.EAA01451@smc.vnet.net>
  • Reply-to: cfo at lanl.gov

On Thursday 05 July 2007 02:01:24 Diana wrote:
> Can someone help me with this trick?
>
> I would like to create the following sequence, based on FactorInteger:
>
> 2,3,22,5,23,7,222,33,25,11,223,13,27,35,2222, ...
>
> where each term is the concatenation of the prime factors of n.
>
> Thanks,
>
> Diana

concatFactors[x_] := 
   ToExpression[
     StringJoin[ToString /@ Flatten[Apply[Table[#1, {#2}] & , 
             FactorInteger[x], {1}]]]]

   Hope that helps!

 Testing:
In[86]:= concatFactors /@ Range[20]

Out[86]= {1, 2, 3, 22, 5, 23, 7, 222, 33, 25, 11, 223, 13, 27, 35, \
2222, 17, 233, 19, 225}

-- 
==========================================================
Curtis Osterhoudt
cfo at remove_this.lanl.and_this.gov
PGP Key ID: 0x4DCA2A10
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================


  • Prev by Date: Re: V6: ListPlot memory requeriments
  • Next by Date: Problems with ShowLegend
  • Previous by thread: Re: Concatenation of prime factors of numbers
  • Next by thread: Re: Concatenation of prime factors of numbers