Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

FindInstance for sum of primes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115478] FindInstance for sum of primes
  • From: leigh pascoe <leigh at evry.inserm.fr>
  • Date: Tue, 11 Jan 2011 19:25:14 -0500 (EST)

Dear Mathgroup,

2011 is the sum of 11 consecutive primes. I want to check if any other 
years have a similar property.

Now define

f[n_, m_] := Sum[Prime[i], {i, n, n + m}];
eq = Mod[f[n, m] - year, 1000] == 0

and we see that

In[64]:= Mod[f[37, 10] - 2011, 1000]

Out[64]= 0

but

In[65]:= FindInstance[eq, {n, m, year}, Integers]

During evaluation of In[65]:= FindInstance::exvar: The system contains a 
nonconstant expression i independent of variables {n,m,year}. >>

Out[65]= FindInstance[Mod[-year + \!\(\*UnderoverscriptBox[\(\[Sum]\), 
\(i = n\), \(m + n\)]\(Prime[i]\)\), 1000] == 0, {n, m, year}, Integers]

Apparently FindInstance doesn't like the dummy variable "i". How can we 
perform this search in Mathematica??

LP


  • Prev by Date: question on diophantine equations in Mathematica
  • Next by Date: Re: ParsedBoxWrapper's in packages
  • Previous by thread: Re: question on diophantine equations in Mathematica
  • Next by thread: Re: FindInstance for sum of primes