id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

isRelativelyPrime


Returns true if the two integer arguments a and b are relatively prime. Two integers are relatively prime if the only positive integer (factor) that divides both of them is 1. For example, the factors of 14 are 2 & 7 and the factors of 15 are 3 & 5. 14 and 15 are relatively prime since they have no common factor. Both a and b will be larger than 1.


isRelativelyPrime(14, 15) → true
isRelativelyPrime(12, 15) → false
isRelativelyPrime(22, 21) → true

...Save, Compile, Run (ctrl-enter)

public boolean isRelativelyPrime(int a, int b){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 180 Post-solution available

Copyright Nick Parlante 2017 - privacy