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

 

jebbert@volusia.k12.fl.us > dec16_2019_BONUS_amicable
prev  |  next  |  chance

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220. Evaluate the sum of all the amicable numbers between 1 and the input parameter 'max'. The parameter 'max' will be an integer between 1 and 20000. Note that in some cases one or more of the pairs of amicable numbers will be below 'max', while the other one(s) are above 'max'. These still count towards the sum, but only the ones that are below 'max'.


dec16_2019_BONUS_amicable(220) → 220
dec16_2019_BONUS_amicable(221) → 220
dec16_2019_BONUS_amicable(223) → 220

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

public int dec16_2019_BONUS_amicable(int max) }

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

Copyright Nick Parlante 2017 - privacy