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

 

orion.a.smith@gmail.com apcsa-loops > apcsaLoopsSumFactors
prev  |  next  |  chance

Given an int input, compute the sum of all the factors of the input. A factor of num is a number from 1 to num that num divides with no remainder, in other words: num % factor == 0.


Note: When the sum of the factors is num+1, what does that mean you have found?

Note: What is the interesting pattern when num is a power of 2?

apcsaLoopsSumFactors(5) → 6
apcsaLoopsSumFactors(100) → 217
apcsaLoopsSumFactors(103) → 104

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

public int apcsaLoopsSumFactors(int num) { }

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: 150

Copyright Nick Parlante 2017 - privacy