Close

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

    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 VIP Member 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
    --------------------------------
    Free Domain @
    http://www.hexhost.com
    --------------------------------

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

    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

Similar Threads

  1. Urgent - any cubase experts PLEASE ?
    By Panda in forum PC Software
    Replies: 0
    Last Post: 2nd April 2003, 06:28 PM
  2. Any Fiat Experts???
    By BILKO1 in forum Cars & Motorbikes
    Replies: 3
    Last Post: 4th March 2003, 12:35 AM
  3. Any experts please help...
    By saiyan in forum Nintendo Consoles
    Replies: 8
    Last Post: 20th February 2003, 01:26 AM
  4. Any closet mac fans/experts out there??
    By maltloaf in forum PC Hardware
    Replies: 5
    Last Post: 12th February 2003, 06:21 PM
  5. 2 u experts 6130 on voda[is it possible]
    By tonyevo5 in forum Unlocking Questions & Solutions
    Replies: 2
    Last Post: 14th November 2002, 10:30 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
  •