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

 

gaurav.gupta@mq.edu.au loops > primeFactors
prev  |  next  |  chance

First, solve this problem: https://codingbat.com/prob/p202617 and then come to the current problem. Define a function that when passed an integer, returns the number of prime factors of the number. Note that if a number is a prime, it has only one prime factor: the number itself.


primeFactors(73) → 1
primeFactors(77) → 2
primeFactors(2147483641) → 2

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

int primeFactors(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: 5 Post-solution available

Copyright Nick Parlante 2017 - privacy