Re: Concatenation of prime factors of numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg78636] Re: Concatenation of prime factors of numbers
- From: dh <dh at metrohm.ch>
- Date: Thu, 5 Jul 2007 05:58:42 -0400 (EDT)
- References: <f6i940$1mj$1@smc.vnet.net>
Hello Diana,
that can be done by:
-FactorInteger
-Convert the factor to a string and duplicate the string as many times
as the exponent indicates. This produces a list
-Flatten superfluous braces
- Apply StringJoin to the list of strings
-convert the strings to numbers using ToExpression:
- the above procedure may packed into a function and mapped to a list of
numbers:
ToExpression @ StringJoin @@ Flatten @
(Table[ToString[#[[1]]],{#[[2]]}]&/@ FactorInteger[#]) &
/@ Range[16]
this gives: {1,2,3,22,5,23,7,222,33,25,11,223,13,27,35,2222}
hope this helps, Daniel
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
>
>