Codegolf Rainbow : Fun with Integer-Arrays Introduction:

 (Source: Wikipedia)
When we look at a rainbow it will always have the colors from top to bottom:
Red; orange; yellow; green; blue; indigo; violet

If we look at these individual rings, the red ring is of course bigger than the violet ring.
In addition, it's also possible to have two or even three rainbow at the same time.

All this above combined will be used in this challenge:

Challenge:

Given a list of integers of exactly size 7, where each value indicates the color-particles available to form rainbows (where the largest index indicates red and the smallest index indicated violet), output the amount of rainbows that can be formed.

A single integer-rainbow has to have at least 3x violet, 4x indigo, 5x blue, 6x green, 7x yellow, 8x orange, 9x red. A second rainbow on top of it will be even bigger than the red ring of the first rainbow (including one space between them), so it will need at least 11x violet, 12x indigo, 13x blue, 14x green, 15x yellow, 16x orange, 17x red in addition to what the first rainbow uses. The third rainbow will start at 19x violet again.

Example:

Input-list: [15,20,18,33,24,29,41]
Output: 2

Why? We have 15x violet, and we need at least 3+11=14 for two rainbows. We have 20 indigo and we need at least 4+12=16 for two rainbows. Etc. We have enough colors for two rainbows, but not enough to form three rainbows, so the output is 2.

Challenge rules:


The integers in the input-array are guaranteed to be non-negative (&gt;= 0).
The input-list is guaranteed to be of size 7 exactly.
When no rainbows can be formed we output 0.
Input and output format is flexible. Can be a list or array of integers of decimals, can be taken from STDIN. Output can be a return from a function in any reasonable output-type, or printed directly to STDOUT.


Minimum amount of colors required for n amount of rainbows:

Amount of Rainbows    Minimum amount per color
0                     [0,0,0,0,0,0,0]
1                     [3,4,5,6,7,8,9]
2                     [14,16,18,20,22,24,26]
3                     [33,36,39,42,45,48,51]
4                     [60,64,68,72,76,80,84]
5                     [95,100,105,110,115,120,125]
etc...


General rules:


This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code.
Also, adding an explanation for your answer is highly recommended.


Test cases:

Input:  [15,20,18,33,24,29,41]
Output: 2

Input:  [3,4,5,6,7,8,9]
Output: 1

Input:  [9,8,7,6,5,4,3]
Output: 0

Input:  [100,100,100,100,100,100,100]
Output: 4

Input:  [53,58,90,42,111,57,66]
Output: 3

Input:  [0,0,0,0,0,0,0]
Output: 0

Input:  [95,100,105,110,115,120,125]
Output: 5

Input:  [39525,41278,39333,44444,39502,39599,39699]
Output: 98
Pyth, 14 bytes

thS.ef&lt;b*+tkyy


Test suite!

How?

Algortihm

First off, let's derive the formula this answer is based off. Let's call the function that gives the necessary amount of colour particles \$C(n, i)\$, where \$n\$ is the number of layers and \$i\$ is the index of the colour, 0-based. First, we note that for the \$n^\text{th}\$ layer alone (where \$n\$ is 1-indexed, in this case), we need \$L(n, i)=i+3+8(n-1)\$ colour particles. Keeping this in mind, we sum the results of each \$L(k, i)\$ for each layer \$k\$:

$$C(n, i)=\color{red}{\underbrace{(i+3)}_{1^\text{st} \text{ layer}}} + \color{blue}{\underbrace{(i+3+8)}_{2^\text{nd} \text{ layer}}}+\cdots + \color{green}{\underbrace{[i+3+8(n-1)]}_{n^\text{th} \text{ layer}}}$$
$$C(n, i)=(i+3)n+8\left(0+1+\cdots +n-1\right)$$
$$C(n, i) = (i+3)n+8\cdot\frac{(n-1)n}{2}=(i+3)n+4n(n-1)$$
$$C(n, i)=n(i+3+4n-4)\implies \boxed{C(n,i)=n(4n+i-1)}$$

Therefore, we now know that the maximum number of possible layers, call it \$k\$, must satisfy the inequality \$C(k, i) \le I_i\$, where \$I_i\$ is the \$i^\text{th}\$ element of the input list.

Implementation

This implements the function \$C\$, and iterates (.e) over the input list, with \$k\$ being the index (0-based) and \$b\$ being the element. For each value, the program searches the first positive integer \$T\$ for which \$b&lt;C(T, i)\$ (the logical negation of \$C(T, i)\le b\$, the condition we deduced earlier), then finds the minimum result and decrements it. This way, instead of searching for the highest integer that does satisfy a condition, we search for the lowest that does not and subtract one from it to make up for the offset of 1.