Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

help


  • Please log in to reply
4 replies to this topic

#1 ballin24

ballin24

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:06:13 AM

Posted 24 October 2010 - 08:21 PM

trying to see if someone can help me write this program if your not busy

BC AdBot (Login to Remove)

 


#2 rigel

rigel

    FD-BC


  • Members
  • 12,944 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:South Carolina - USA
  • Local time:08:13 AM

Posted 24 October 2010 - 08:26 PM

Is this something you are doing for school? If so, we will not do the work for you, but if you wish to post what you have already done, or ask about how a piece of code works, we can do that.

"In a world where you can be anything, be yourself." ~ unknown

"Fall in love with someone who deserves your heart. Not someone who plays with it. Will Smith


#3 ballin24

ballin24
  • Topic Starter

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:06:13 AM

Posted 24 October 2010 - 08:30 PM

no its not

im practicing doing algorithms and puesdocode but im confused on this one

#4 ballin24

ballin24
  • Topic Starter

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:06:13 AM

Posted 24 October 2010 - 08:35 PM

A prime number is an integer greater than 1 whose only integer factors are 1 and itself. A right-
truncatable prime number (or right-prime number) is a prime number that remains prime as each
of its rightmost digits is removed. For example, consider the value 719. 719 is prime, 71 is prime,
and 7 is prime. Thus, 719 is a right-prime number.

Alternatively, consider the value 97. Although 97 is prime, 9 is not. Thus, 97 is not a right-prime
number.

Your algorithm should indicate where in your program you will use
loops, where you will use decision statements, and what computations you will make.

The input to the program is a single integer y. The input value may be any number between 2 and
2
31
-1 ( 2,147,483,647), inclusive. Given an input value y, write a program that determines if y is
right-prime.

The program should produce exactly one line of text as output which indicates whether y is a
right-prime. The main function should input the value from stdin and output the text to stdout.

The conversion from input to output should be performed in a different function called
isRightPrime. This function should accept an integer parameter which will be the value to test to
see if it is right-prime. In addition, this function should return an integer value that equals 1 if the
number is right-prime and 0 if it is not right-prime. This function will need the ability to determine if
successive values are prime, so it should call the isPrime function described below.

The isPrime function should accept an integer parameter, x, which will be the value to test to see
if it is prime. In addition, this function should return an integer value that equals 1 if x is prime and
0 if x is not prime to isRightPrime.

#5 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:07:13 AM

Posted 24 October 2010 - 09:44 PM

You should post what you have done in solving that problem so far and BC community would correct you or guide you if needed. Who knows, you might post the correct solution yourself :thumbsup:

You can find information on Primality testing methods here : http://en.wikipedia.org/wiki/Primality_test

Edited by Romeo29, 24 October 2010 - 09:48 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users