Close

Results 1 to 4 of 4
  1. #1
    DF PlaYa GETanner's Avatar
    Join Date
    May 2001
    Location
    Now now now.
    Posts
    511
    Thanks
    0
    Thanked:        0
    Karma Level
    213

    Default Fortran, any experts about?

    Hi chaps,

    A mate's girlfriend has been lumbered with some uni coursework that she can not understand.

    Obviously I'm not looking for a complete solution (unless you have a few spare minutes) but some internet resources or idiots guide would be a great help.

    The question is below.

    Cheers,

    G



    Using an array constructor and the WHERE statement, implement the following algorithm for finding prime numbers:

    1. Define a vector, PRIME of size n

    2. Initialise PRIME such that PRIME(i) = i for i = 1 , n

    3. Set i = 2

    4. For all j > i, (j (i + 1:n) if PRIME(j) is exactly divisible by i the set PRIME(j) = 0 [Hint: Use the MOD intrinsic in conjuction with a WHERE statement]

    5. Increment i

    6. If i equals n the exit

    7. If PRIME(i) is zero then repeat from step 5

    8. Repeat from step 4

    9. Print out all non-zero entries of the vector (the prime numbers) [Hint: Check what PACK intrinsic does]


    Thanks for any help chaps, I do not have a clue.

  2. #2
    DF Wh0re Mark_1983's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    104
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default

    does it have to be in fortran because i could probably help you if it was c++ or vb

  3. #3
    DF PlaYa GETanner's Avatar
    Join Date
    May 2001
    Location
    Now now now.
    Posts
    511
    Thanks
    0
    Thanked:        0
    Karma Level
    213

    Default

    Mark,

    thanks for the offer pal, but it needs to be in Fortran.

    Cheers any way.

    G

  4. #4
    gernBOT
    Guest gernBOT's Avatar

    Default

    you could try here m8 :

    [Only registered and activated users can see links. ]

Similar Threads

  1. Any IOS experts please?
    By ashtech in forum Apple Mobile Devices
    Replies: 12
    Last Post: 25th December 2012, 08:36 PM
  2. One ofr the Sky experts!
    By ivrytwr3 in forum Digital Satellite TV
    Replies: 30
    Last Post: 11th December 2010, 09:27 PM
  3. [HELP] C.V. experts
    By Mobileman in forum Job Centre
    Replies: 25
    Last Post: 11th August 2010, 11:30 PM
  4. John Backus ~ Fortran Inventor Has Died
    By Legal Eagle in forum Programming
    Replies: 1
    Last Post: 26th March 2007, 10:36 AM
  5. Fortran Code Help!
    By Tammer in forum Programming
    Replies: 8
    Last Post: 24th March 2005, 02:00 PM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •