Calculate the lowest number where the sum of the sequence of numbers exceeds a given value
Jelly, 18 12 11 10 bytes
1Æs>¥#ḢṄÆs
Try it online!
-1 byte thanks to Mr. Xcoder!
How it works
1Æs>¥#ḢṄÆs - Main link. Argument: n (integer)
1 ¥# - Find the first n integers where...
Æs - the divisor sum
> - is greater than the input
Ṅ - Print...
Ḣ - the first element
Æs - then print the divisor sum
Brachylog, 9 bytes
∧;S?hf+S>
This program takes input from the "output variable" .
, and outputs to the "input variable" ?
.
Try it online!
Explanation
∧;S?hf+S>
∧;S There is a pair [N,S]
? which equals the output
h such that its first element's
f factors'
+ sum
S equals S,
> and is greater than the input.
The implicit variable N
is enumerated in increasing order, so its lowest legal value is used for the output.
Japt, 15 bytes
[@<(V=Xâ x}a V]
Try it
Explanation
Implicit input of integer U
. []
is our array wrapper. For the first element, @ }a
is a function that run continuously until it returns a truthy value, passing itself an incrementing integer (starting at 0) each time, and outputting the final value of that integer. â
gets the divisors of the current integer (X
), x
sums them and that result is assigned to variable V
. <
checks if U
is less than V
. The second element in the array is then just V
.