As of May 4 2007 the scripts will autodetect your timezone settings. Nothing here has to be changed, but there are a few things

Please follow this blog

Search this blog

Tuesday, March 30, 2010

Generalising solutions to problems

When writing a program it is a challenge to make a program reusable. The same can be done to solutions of exercises. You can try to generalise the solution. I generalized a result of a number theory problem I solved.

Let n be a positive integer and D the set of divisors of n. We are interested in the sum of all quotients a/b, where a,b in D and GCD(a,b)=1.

Example
n=5
D={1,5}
Quotients: {1/1, 5/1, 1/5}
Sum 6 1/5

n=12
D={1,2,3,4,6,12}
Quotients: {1/1, 2/1, 3/1, 4/1, 6/1, 12/1, 1/2, 3/2, 1/3, 2/3, 4/3, 1/4, 3/4, 1/6, 1/12}
Sum 33 7/12

Formula:
g[{x_,y_}]:=(1-x^(2y+1))/((1-x)*x^y)
f[n_]:=Apply[Times,Map[g,FactorInteger[n]]]
( In Mathematica format )
The function is Arithmetic, i.e. f[x]*f[y] = f[x*y] if GCD[x,y]=1.

Explanation.
If p is a prime then
f[p^n] = p^n + p^(n-1) + ... + 1 + 1/p + 1/p^2 + ... + 1/p^n
now use the fact that f is arithmetic and map the primefactorization of n to this function.

No comments:

Post a Comment

Popular Posts

Welcome to The Bridge

Mathematics: is it the fabric of MEST?
This is my voyage
My continuous mission
To uncover hidden structures
To create new theorems and proofs
To boldly go where no man has gone before




(Raumpatrouille – Die phantastischen Abenteuer des Raumschiffes Orion, colloquially aka Raumpatrouille Orion was the first German science fiction television series. Its seven episodes were broadcast by ARD beginning September 17, 1966. The series has since acquired cult status in Germany. Broadcast six years before Star Trek first aired in West Germany (in 1972), it became a huge success.)