Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2025-04-10 20:43:21

RegJose
Novice
Registered: 2025-04-10
Posts: 8

Proportionally decrease the values of one or more lists to reach a t

Proportionally decrease the values of one or more lists to reach a target sum.

Consider these three or more lists of integer values:
[30, 0, 100, 50, 30] = 210, Importance = 100
[20, 40, 90, 10, 0] = 160, Importance = 80
[1, 10, 30, 0, 500] = 550, Importance = 60

Their total sum is 920. The goal is to make the new "target" sum of all the lists, for example, 200.

What would be a good way to proportionally decrease the values of the lists to achieve the new sum? The values should remain integers.

Additional:
1. In each list, if necessary, try to decrease the highest values more and decrease the lowest values less or not at all.

2.- Each list can have an additional value called "importance," ranging from 0 to 100. 0 indicates that the values in this list are not used. 60 indicates that we give the list 60% importance. This way, we can make the values in one list lower, favoring the values in the other lists.

If possible, I need an example C function.

Offline

#2 2025-04-10 20:58:54

RegJose
Novice
Registered: 2025-04-10
Posts: 8

Re: Proportionally decrease the values of one or more lists to reach a t

I almost forgot: But we should try to keep the lowest values from decreasing. Example:
Having [30, 0, 100, 90, 30] = 250
Ideally, [30, 0, 70, 70, 30] = 200

Offline

#3 2025-04-10 21:44:42

Bob
Administrator
Registered: 2010-06-20
Posts: 10,740

Re: Proportionally decrease the values of one or more lists to reach a t

hi RegJose

Welcome to the forum.

I'm not understanding this problem.

Consider these three or more lists of integer values:
[30, 0, 100, 50, 30] = 210, Importance = 100
[20, 40, 90, 10, 0] = 160, Importance = 80
[1, 10, 30, 0, 500] = 550, Importance = 60

The equals looks like you're adding the integers inside the square brackets eg 30 + 0 + 100 + 50 + 30 = 210

But 1 + 10 + 30 + 0 + 500   ≠ 550 so is my interpretation correct and there's a typo here. If not then how does the square bracket numbers give the number after the equals?

Importance looks like its the biggest number inside the square brackets eg 100 is the biggest in the first set.  But that fails for the other two sets, so how are you defining importance?

Once I'm clear on those issues it'll be worth reading on.

Thanks,
Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#4 2025-04-10 22:02:06

ktesla39
Member
From: Nepal
Registered: 2024-10-08
Posts: 261
Website

Re: Proportionally decrease the values of one or more lists to reach a t

Same here.

So please provide clear description of the problem.


"Talent hits the target no one else can hit. Genius hits the target no one else can see." - Arthur Schopenhauer

Offline

#5 2025-04-11 04:01:03

KerimF
Member
From: Aleppo-Syria
Registered: 2018-08-10
Posts: 281

Re: Proportionally decrease the values of one or more lists to reach a t

same here


Every living thing has no choice but to execute its pre-programmed instructions embedded in it (known as instincts).
But only a human may have the freedom and ability to oppose his natural robotic nature.
But, by opposing it, such a human becomes no more of this world.

Offline

#6 2025-04-11 12:46:26

RegJose
Novice
Registered: 2025-04-10
Posts: 8

Re: Proportionally decrease the values of one or more lists to reach a t

Can't edit or delete it? Delete this post and we'll start with a new one I've already created. Thanks.

Offline

#7 2025-04-18 14:13:05

Garciae3
Novice
Registered: 2025-04-18
Posts: 1

Re: Proportionally decrease the values of one or more lists to reach a t

That's an interesting challenge! Sounds like you're trying to bring a group of numbers down to a target value. It's kind of like when I'm playing the Dinosaur Game and need to lower my score proportionally to avoid getting a game over. Finding that sweet spot where everything balances just right can be tricky, but satisfying when you nail it. Managing multiple lists at once adds another layer of complexity. Good luck!

Offline

Board footer

Powered by FluxBB