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

 

primeCombination


Solve this problem first: https://codingbat.com/prob/p298339 Define a function that when passed an integer, returns true if it can be split in a way that the left and right parts are both prime, false otherwise.

For example, you can split 7313 right down the middle and the left part - 73, and the right part 13, are both primes. BTW, you can also split it after the 7 so that both 7 and 313 are prime.

Similarly, 893 split after the 9 results in primes on either side - 89 and 3.

However, 277 cannot be split in a way that the left and right parts are prime.


primeCombination(277) → false
primeCombination(893) → true
primeCombination(7313) → true

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

boolean primeCombination(int n) { }

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: 4 Post-solution available

Copyright Nick Parlante 2017 - privacy