MathGroup Archive 2003

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

Search the Archive

Processing lists of unrelated numbers with Do or While statement


Folks,

I had a problem recently where I tried to determing the PrimePi value of 2
times a number minus that number. This is verifying the Bertrand's
Postulate:

PrimePi(2x) - PrimePi(x) >=1 for all x >=2, elements of Z.

Well,

I finally came up with:
PrimePi[2*{2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001} -
{2, 3, 5, 7,
        13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001}]

gives:
{1, 2, 3, 4, 6, 9, 14, 23, 38, 66, 115, 205, 368, 551}
the desired answer.
Is there a way to process unrelated numbers with a Do or While or NestWhile
statement?
Thanks,
Diana

--
=====================================================
"God made the integers, all else is the work of man."
L. Kronecker, Jahresber. DMV 2, S. 19.



  • Prev by Date: Re: Writing a program to hunt for a prime between n^2 and (n+1)^2
  • Next by Date: To verify Cauchy-Riemann relations in complex variable graphically
  • Previous by thread: Re: Problem with NIntegrate -- Monte Carlo
  • Next by thread: Re: Processing lists of unrelated numbers with Do or While statement