Re: Working with factors of triangular numbers.
- To: mathgroup at smc.vnet.net
- Subject: [mg78554] Re: Working with factors of triangular numbers.
- From: dh <dh at metrohm.ch>
- Date: Wed, 4 Jul 2007 05:33:15 -0400 (EDT)
- References: <f6d4ll$hka$1@smc.vnet.net>
Hi Diana,
I assume that d contains a list of numbers and n the requested number of
factors. I further assume that you want to count multiplicities. For
this we:
- apply FactorInteger to each element of the data to get factorization
- from the output of FactorInteger we extract the exponents
- we add all exponents what gives the number of factors
- we then use Pick to get the list elements with the requested number of
factors and take the first element:
n=2;
d={0,2,5,9,14,20};
tmp=(Plus@@FactorInteger[#][[All,2]])&/@d
Pick[d,tmp,n][[1]]
hope this helps, Daniel
Diana wrote:
> Math folks,
>
> I first generate a list of triangular numbers:
>
> 1, 3, 6, 10, 15, 21, ...
>
> and then subtract one from each as:
>
> 0, 2, 5, 9, 14, 20, ...
>
> I am trying to find the smallest triangular number (minus one) which
> can be written as a product of "n" distinct factors, each factor > 1.
>
> For example:
>
> a(2) = 15, because 2*7 + 1 = 15.
> a(3) = 55, because 2*3*9 + 1 = 55.
>
> I have worked with Divisors and FactorInteger, but am getting bogged
> down with repeated terms. Can someone think of a neat trick to work
> this problem?
>
> Diana M.
>
>