Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: Processing lists of unrelated numbers with Do or While statement

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39198] Re: Processing lists of unrelated numbers with Do or While statement
  • From: "Diana" <diana53xiii at earthlink.remove13.net>
  • Date: Mon, 3 Feb 2003 01:10:05 -0500 (EST)
  • References: <b1idal$bja$1@smc.vnet.net>
  • Reply-to: "Diana" <diana53xiii at earthlink.remove13.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bob,

Thanks for getting back to me. When I type in your code:

(PrimePi[2#]-PrimePi[#]&) /@ x

     {1, 1, 1, 2, 3, 5, 9, 15, 28, 49, 90, 163, 302, 456}

I get:

{2 x, 3 x, 5 x, 7 x, 13 x, 23 x, 43 x, 83 x, 163 x, 317 x, 631 x,
  1259 x, 2503 x, 4001 x}

Have I mis-applied your code?

Thanks, Diana

"Diana" <diana53xiii at earthlink.remove13.net> wrote in message
news:b1idal$bja$1 at smc.vnet.net...
> 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: RealOnly
  • Next by Date: Re: Re: Writing a program to hunt for a prime between n^2 and (n+1)^2
  • Previous by thread: Re: Processing lists of unrelated numbers with Do or While statement
  • Next by thread: Re: Processing lists of unrelated numbers with Do or While statement