Results 1 to 4 of 4

Thread: Prime numbers

  1. #1
    tercius is offline Member
    Join Date
    May 2008
    Posts
    1
    Rep Power
    0

    Default Prime numbers

    Hello, I am trying to solve this problem:
    A positive integer is said to be k-smooth if none of its prime factors exceeds k. Compute how many positive integers less than or equal to N are k-smooth.
    Input

    The input contains multiple test cases (less than 50). Each test case consists of two lines. The first one contains an integer N (1 ≤ N ≤ 5,000,000), the second one an integer k (1 ≤ k ≤ 1000).
    Output

    For each test case output a single line with the corresponding answer.

    Can anyone help me? thanks

  2. #2
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    7

    Default

    whats your problem. Nobody is going to do your assignment for you.
    My IP address is 127.0.0.1

  3. #3
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    Nobody is going to do your assignment for you.
    Maybe that is he's problem....

    What have you done so far?
    freedom exists in the world of ideas

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Line of sequential thinking leading to success in this:
    1 generate some primes to be sure you can do so
    2 for a given integer N find the primes that are factors of N
    3 for a given limit k see if any of the primeFactors exceed k
    4 print result

Similar Threads

  1. Counting numbers up and down
    By radio in forum New To Java
    Replies: 4
    Last Post: 05-06-2011, 03:03 PM
  2. Finding Largest Prime Factor
    By perito in forum New To Java
    Replies: 7
    Last Post: 11-08-2010, 08:25 PM
  3. Computing prime numbers in Java
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-12-2008, 08:39 PM
  4. Prime numbers
    By gapper in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 10:09 AM
  5. random numbers
    By carlos123 in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 02:56 AM

Posting Permissions

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