Solve for upperbound of a summation to find the nearest LCM to a given #

  • Context: MHB 
  • Thread starter Thread starter Jaded Dreamking
  • Start date Start date
  • Tags Tags
    Summation
Click For Summary
SUMMARY

This discussion focuses on finding the nearest least common multiple (LCM) of consecutive integers (1-n) and the challenges of deconstructing a given LCM to find n. Key methods discussed include using the Prime Pi function, the Mangoldt function, and various Mathematica commands such as Product, DivisorSigma, and Apply. The user also explores advanced mathematical concepts like the Psi function and logarithmic properties to estimate LCM values near 10^(10^10). The conversation highlights the complexity of implementing these methods in Mathematica and suggests considering Python for easier programming.

PREREQUISITES
  • Understanding of LCM and its properties
  • Familiarity with Mathematica programming language
  • Knowledge of prime number functions, specifically PrimePi and MangoldtLambda
  • Basic concepts of logarithms and their applications in mathematics
NEXT STEPS
  • Learn how to implement the Prime Pi function in Mathematica
  • Explore the Mangoldt function and its applications in number theory
  • Study the use of logarithmic functions in estimating LCM values
  • Investigate alternative programming languages like Python for mathematical computations
USEFUL FOR

Mathematicians, computer scientists, and programmers interested in number theory, specifically those working with LCM calculations and Mathematica programming.

Jaded Dreamking
Messages
1
Reaction score
0
I've been doing some work with finding the LCM of consecutive integers (1-n) and the number of factors in such an LCM.
It's become easy to construct an LCM and find the factors when n is given.
However, to deconstruct a given LCM and find n is proving difficult.
I eventually would like to find the nearest LCM either above or below a value.
It would be nice to have the one above, but I could make due with the one below.

I've been provided with a few ways of doing this that I'd like to show
and see if anyone can show me
how to solve it algebraically or code for my objective.

The first uses Prime Pi.

Product[Prime^Floor[Log[Prime, 11]], {i, PrimePi[11]}]

Out: 27720

Product[Floor[1 + Log[Prime, 11]], {i, PrimePi[11]}]

Out: 96

Also, I'd like to note that if PrimePi[] exceeds the value of n (11), then it does not affect the outcome.
And for some reason, the "" would not copy and paste behind Prime. I had to enter that manually. A bug perhaps?
And my computer let me know :
"The Mathematica command giving the prime counting function for a \ number x is PrimePi[x], which works up to a maximum value of x approx 8*10^(13)."

The second uses the Mangoldt function to construct the LCM.

Product[E^MangoldtLambda[n],{n, 2, 11}]

Out: 27720

and then using DivisorSigma [0,LCM] to find divisors / factors :

DivisorSigma[0, Product[E^MangoldtLambda[n],{n, 2, 11}]]and then there's what I refer to as the Apply method:

Apply[LCM, Range[11]]

and then I use DivisorSigma with that like this:

DivisorSigma[0, Apply[LCM, Range[11]]]

and then there's what I refer to as the PrimeQ method for which I only know how to find factors with given n:

Times @@ Map[Floor[1 + Log[#, 11]] &, Select[Range[2, 11], PrimeQ]]

and then there's the Cyclotomic method

Product[Cyclotomic[n, 1],{n, 2, 11}]I've read a couple of equations that I haven't been able to implement in mathematica

One webpage said that the LCM of (1-n) is equal to

E^(n*(1 + \[Omicron]*1))

which is too high of math for me to understand.

Another one out of my reach is: Psi(x) = ln (1,2,3,...,x)
If not psi, then it might be a similar symbol like PolyGamma
I figured that I could then take e^Psi(x) to get the LCM of (1-n).

I estimated that the target objective, the LCM of (1-n) that is somewhere near 10^(10^10) :

Floor[1+Log10[LCM@@Range[2297]]]//AbsoluteTiming

{0.0156250,1000}

Floor[1+Log10[LCM@@Range[23013]]]//AbsoluteTiming

{0.1406250,9998}

Floor[1+Log10[LCM@@Range[230075]]]//AbsoluteTiming

{2.6406250,99997}

Floor[1+Log10[LCM@@Range[2302149]]]//AbsoluteTiming

{63.7500000,999997}

Floor[1+Log10[Floor[1+Log10[LCM@@Range[23021490000]]]]]//AbsoluteTiming

And this last bit of code I have tried to run overnight and my 32 bit confuser didn't give.

My last thought was that since log_a(xy) = log_a(x) + log_a(y), then I need to solve for n where:

Sum of Log_10(e^(MangoldtLambda(n))) => (10^10). I tried:

NSolve[[[\!\(\*UnderoverscriptBox[\(\\), \(x = 2\), \(\\)]\(Floor[1 + Log10[\([E^MangoldtLambda[x], {x, 2, \}]\)]]\)\)] >= 10^10], x]

but the code isn't working for me.:confused:
 
Physics news on Phys.org
Jaded Dreamking said:
I've been doing some work with finding the LCM of consecutive integers (1-n) and the number of factors in such an LCM.
It's become easy to construct an LCM and find the factors when n is given.
However, to deconstruct a given LCM and find n is proving difficult.
I eventually would like to find the nearest LCM either above or below a value.
It would be nice to have the one above, but I could make due with the one below.

I've been provided with a few ways of doing this that I'd like to show
and see if anyone can show me
how to solve it algebraically or code for my objective.

The first uses Prime Pi.

Product[Prime^Floor[Log[Prime, 11]], {i, PrimePi[11]}]

Out: 27720

Product[Floor[1 + Log[Prime, 11]], {i, PrimePi[11]}]

Out: 96

Also, I'd like to note that if PrimePi[] exceeds the value of n (11), then it does not affect the outcome.
And for some reason, the "" would not copy and paste behind Prime. I had to enter that manually. A bug perhaps?
And my computer let me know :
"The Mathematica command giving the prime counting function for a \ number x is PrimePi[x], which works up to a maximum value of x approx 8*10^(13)."

The second uses the Mangoldt function to construct the LCM.

Product[E^MangoldtLambda[n],{n, 2, 11}]

Out: 27720

and then using DivisorSigma [0,LCM] to find divisors / factors :

DivisorSigma[0, Product[E^MangoldtLambda[n],{n, 2, 11}]]and then there's what I refer to as the Apply method:

Apply[LCM, Range[11]]

and then I use DivisorSigma with that like this:

DivisorSigma[0, Apply[LCM, Range[11]]]

and then there's what I refer to as the PrimeQ method for which I only know how to find factors with given n:

Times @@ Map[Floor[1 + Log[#, 11]] &, Select[Range[2, 11], PrimeQ]]

and then there's the Cyclotomic method

Product[Cyclotomic[n, 1],{n, 2, 11}]I've read a couple of equations that I haven't been able to implement in mathematica

One webpage said that the LCM of (1-n) is equal to

E^(n*(1 + \[Omicron]*1))

which is too high of math for me to understand.

Another one out of my reach is: Psi(x) = ln (1,2,3,...,x)
If not psi, then it might be a similar symbol like PolyGamma
I figured that I could then take e^Psi(x) to get the LCM of (1-n).

I estimated that the target objective, the LCM of (1-n) that is somewhere near 10^(10^10) :

Floor[1+Log10[LCM@@Range[2297]]]//AbsoluteTiming

{0.0156250,1000}

Floor[1+Log10[LCM@@Range[23013]]]//AbsoluteTiming

{0.1406250,9998}

Floor[1+Log10[LCM@@Range[230075]]]//AbsoluteTiming

{2.6406250,99997}

Floor[1+Log10[LCM@@Range[2302149]]]//AbsoluteTiming

{63.7500000,999997}

Floor[1+Log10[Floor[1+Log10[LCM@@Range[23021490000]]]]]//AbsoluteTiming

And this last bit of code I have tried to run overnight and my 32 bit confuser didn't give.

My last thought was that since log_a(xy) = log_a(x) + log_a(y), then I need to solve for n where:

Sum of Log_10(e^(MangoldtLambda(n))) => (10^10). I tried:

NSolve[[[\!\(\*UnderoverscriptBox[\(\\), \(x = 2\), \(\\)]\(Floor[1 + Log10[\([E^MangoldtLambda[x], {x, 2, \}]\)]]\)\)] >= 10^10], x]

but the code isn't working for me.:confused:


Programming in Mathematica is doable, but I think more difficult than say Python or if you prefer Matlab. I think for what you are looking to do Python may be the way to go; otherwise, you should ask this question on Mathematica Stackexchange since Mathematica programming experts can be found there. I am not trying to detract from MHB but this question may linger a lot longer here compared to there.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
24
Views
2K
Replies
7
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K