Processing lists of unrelated numbers with Do or While statement
- To: mathgroup at smc.vnet.net
- Subject: [mg39175] Processing lists of unrelated numbers with Do or While statement
- From: "Diana" <diana53xiii at earthlink.remove13.net>
- Date: Sun, 2 Feb 2003 01:13:28 -0500 (EST)
- Reply-to: "Diana" <diana53xiii at earthlink.remove13.net>
- Sender: owner-wri-mathgroup at wolfram.com
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.