MathGroup Archive 2000

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

Search the Archive

Re: Divisors

  • To: mathgroup at
  • Subject: [mg24278] Re: Divisors
  • From: Julian Aguirre Estibalez <mtpagesj at>
  • Date: Fri, 7 Jul 2000 00:11:22 -0400 (EDT)
  • Organization: Universidad del Pais Vasco/Euskal Herriko Unibertsitatea
  • References: <8k0v1u$>
  • Sender: owner-wri-mathgroup at

On 5 Jul 2000, Hans Havermann wrote:

> I need a re-formulated "divisors" function that works, *not* on
> Integers, but on the *list of factors* that one gets when one applies
> FactorInteger to a number. That way I can still get the divisors of a
> number whose factorization is difficult, but nonetheless known.

	I ran into the same time of problen a while a go. A solution
provided by Hartmut Wolf was

	divisors=Fold[Flatten[{#1, Outer[Times, #1, #2]}] &, {1},

	This gives the unsorted list of divisors of n. If you want them
ordered, just apply a Sort[]. This is MUCH faster than the Divisors[]
function for integers with lots of divisors.

Julian Aguirre			| Voice:  +34 946012659
Departamento de Matematicas	| Fax:    +34 944648500
Universidad del Pais Vasco	| Postal: Aptdo. 644, 48080 Bilbao, Spain
				| email:  mtpagesj at

  • Prev by Date: lancon
  • Next by Date: Re: Division still cost more than multiplication?
  • Previous by thread: Re: Divisors
  • Next by thread: Re: Divisors