4 minor MathJax update
source | link

$$\begin{cases}q_1=8\\q_2=12\\q_3=12\\q_4=13\\q_5=14\\q_6=14\\q_7=13\\q_n=16,n>7\end{cases}$$$$\begin{cases}q_1=8\\q_2=12\\q_3=12\\q_4=13\\q_5=14\\q_6=14\\q_7=13\\q_n=16,&\text{for }n>7\end{cases}$$

$$\begin{cases}q_1=8\\q_2=12\\q_3=12\\q_4=13\\q_5=14\\q_6=14\\q_7=13\\q_n=16,n>7\end{cases}$$

$$\begin{cases}q_1=8\\q_2=12\\q_3=12\\q_4=13\\q_5=14\\q_6=14\\q_7=13\\q_n=16,&\text{for }n>7\end{cases}$$

3 added expected results in the table
source | link
  n |   a(n-1) | multiplier |      a(n) | flooredoutput |          expected
----+----------+------------+-----------+--------+-------------------
  1 |      n/a |        n/a |         2 |      2 |                2
----+----------+------------+-----------+--------+-------------------
  2 |        2 |          3 |         6 |      6 |                6
  3 |        6 |          2 |        12 |     12 |               12
  4 |       12 |          2 |        24 |     24 |               24
  5 |       24 |      24/13 |     44.31 |      44 |        [40,..,44]
  6 |    44.31 |       12/7 |     75.96 |      75 |        [72,..,78]
  7 |    75.96 |       12/7 |    130.21 |     130 |      [126,..,134]
  8 |   130.21 |      24/13 |    240.39 |    240 |              240
  9 |   240.39 |        3/2 |    360.58 |     360 |      [306,..,364]
 10 |   360.58 |        3/2 |    540.87 |     540 |      [500,..,554]
 11 |   540.87 |        3/2 |    811.31 |     811 |      [582,..,870]
 12 |   811.31 |        3/2 |   1216.97 |    1216 |     [840,..,1357]
 13 |  1216.97 |        3/2 |   1825.45 |    1825 |    [1154,..,2069]
 14 |  1825.45 |        3/2 |   2738.17 |    2738 |    [1606,..,3183]
 15 |  2738.17 |        3/2 |   4107.26 |    4107 |    [2564,..,4866]
 16 |  4107.26 |        3/2 |   6160.89 |    6160 |    [4320,..,7355]
 17 |  6160.89 |        3/2 |   9241.34 |    9241 |   [5346,..,11072]
 18 |  9241.34 |        3/2 |  13862.00 |   13862 |   [7398,..,16572]
 19 | 13862.00 |        3/2 |  20793.01 |   20793 |  [10668,..,24812]
 20 | 20793.01 |        3/2 |  31189.51 |   31189 |  [17400,..,36764]
 21 | 31189.51 |        3/2 |  46784.26 |   46784 |  [27720,..,54584]
 22 | 46784.26 |        3/2 |  70176.40 |   70176 |  [49896,..,82340]
 23 | 70176.40 |        3/2 | 105264.59 |  105264 | [93150,..,124416]
----+----------+------------+-----------+--------+-------------------
 24 |           (hard-coded)            | 196560 |           196560 
  n |   a(n-1) | multiplier |      a(n) | floored
----+----------+------------+-----------+---------
  1 |      n/a |        n/a |         2 |       2
----+----------+------------+-----------+---------
  2 |        2 |          3 |         6 |       6
  3 |        6 |          2 |        12 |      12
  4 |       12 |          2 |        24 |      24
  5 |       24 |      24/13 |     44.31 |      44
  6 |    44.31 |       12/7 |     75.96 |      75
  7 |    75.96 |       12/7 |    130.21 |     130
  8 |   130.21 |      24/13 |    240.39 |     240
  9 |   240.39 |        3/2 |    360.58 |     360
 10 |   360.58 |        3/2 |    540.87 |     540
 11 |   540.87 |        3/2 |    811.31 |     811
 12 |   811.31 |        3/2 |   1216.97 |    1216
 13 |  1216.97 |        3/2 |   1825.45 |    1825
 14 |  1825.45 |        3/2 |   2738.17 |    2738
 15 |  2738.17 |        3/2 |   4107.26 |    4107
 16 |  4107.26 |        3/2 |   6160.89 |    6160
 17 |  6160.89 |        3/2 |   9241.34 |    9241
 18 |  9241.34 |        3/2 |  13862.00 |   13862
 19 | 13862.00 |        3/2 |  20793.01 |   20793
 20 | 20793.01 |        3/2 |  31189.51 |   31189
 21 | 31189.51 |        3/2 |  46784.26 |   46784
 22 | 46784.26 |        3/2 |  70176.40 |   70176
 23 | 70176.40 |        3/2 | 105264.59 |  105264
----+----------+------------+-----------+---------
 24 |         (hard-coded)       196560 |  196560
  n |   a(n-1) | multiplier |      a(n) | output |          expected
----+----------+------------+-----------+--------+-------------------
  1 |      n/a |        n/a |         2 |      2 |                2
----+----------+------------+-----------+--------+-------------------
  2 |        2 |          3 |         6 |      6 |                6
  3 |        6 |          2 |        12 |     12 |               12
  4 |       12 |          2 |        24 |     24 |               24
  5 |       24 |      24/13 |     44.31 |     44 |        [40,..,44]
  6 |    44.31 |       12/7 |     75.96 |     75 |        [72,..,78]
  7 |    75.96 |       12/7 |    130.21 |    130 |      [126,..,134]
  8 |   130.21 |      24/13 |    240.39 |    240 |              240
  9 |   240.39 |        3/2 |    360.58 |    360 |      [306,..,364]
 10 |   360.58 |        3/2 |    540.87 |    540 |      [500,..,554]
 11 |   540.87 |        3/2 |    811.31 |    811 |      [582,..,870]
 12 |   811.31 |        3/2 |   1216.97 |   1216 |     [840,..,1357]
 13 |  1216.97 |        3/2 |   1825.45 |   1825 |    [1154,..,2069]
 14 |  1825.45 |        3/2 |   2738.17 |   2738 |    [1606,..,3183]
 15 |  2738.17 |        3/2 |   4107.26 |   4107 |    [2564,..,4866]
 16 |  4107.26 |        3/2 |   6160.89 |   6160 |    [4320,..,7355]
 17 |  6160.89 |        3/2 |   9241.34 |   9241 |   [5346,..,11072]
 18 |  9241.34 |        3/2 |  13862.00 |  13862 |   [7398,..,16572]
 19 | 13862.00 |        3/2 |  20793.01 |  20793 |  [10668,..,24812]
 20 | 20793.01 |        3/2 |  31189.51 |  31189 |  [17400,..,36764]
 21 | 31189.51 |        3/2 |  46784.26 |  46784 |  [27720,..,54584]
 22 | 46784.26 |        3/2 |  70176.40 |  70176 |  [49896,..,82340]
 23 | 70176.40 |        3/2 | 105264.59 | 105264 | [93150,..,124416]
----+----------+------------+-----------+--------+-------------------
 24 |           (hard-coded)            | 196560 |           196560 
2 added the 'How?' section
source | link
f=(n,k=2)=>=>n<24?--n?f(n,n<23?k*24/(17+~'48443223'[n]17+~'_8443223'[n]):3.7346):k|0~~k:196560

Try it online!Try it online!

How?

The last term \$a_{24}=196560\$ is hard-coded.

All other terms are computed recursively, using:

$$\begin{cases}a_1=2\\a_{n+1}=a_n\times\dfrac{24}{q_n}\end{cases}$$

where \$q_n\$ is defined as:

$$\begin{cases}q_1=8\\q_2=12\\q_3=12\\q_4=13\\q_5=14\\q_6=14\\q_7=13\\q_n=16,n>7\end{cases}$$

leading to the following ratios:

$$3,2,2,\frac{24}{13},\frac{12}{7},\frac{12}{7},\frac{24}{13},\frac{3}{2},\frac{3}{2},\ldots,\frac{3}{2}$$

The final result is eventually floored and returned.

Results summary

Approximated results are given with 2 decimal places.

  n |   a(n-1) | multiplier |      a(n) | floored
----+----------+------------+-----------+---------
  1 |      n/a |        n/a |         2 |       2
----+----------+------------+-----------+---------
  2 |        2 |          3 |         6 |       6
  3 |        6 |          2 |        12 |      12
  4 |       12 |          2 |        24 |      24
  5 |       24 |      24/13 |     44.31 |      44
  6 |    44.31 |       12/7 |     75.96 |      75
  7 |    75.96 |       12/7 |    130.21 |     130
  8 |   130.21 |      24/13 |    240.39 |     240
  9 |   240.39 |        3/2 |    360.58 |     360
 10 |   360.58 |        3/2 |    540.87 |     540
 11 |   540.87 |        3/2 |    811.31 |     811
 12 |   811.31 |        3/2 |   1216.97 |    1216
 13 |  1216.97 |        3/2 |   1825.45 |    1825
 14 |  1825.45 |        3/2 |   2738.17 |    2738
 15 |  2738.17 |        3/2 |   4107.26 |    4107
 16 |  4107.26 |        3/2 |   6160.89 |    6160
 17 |  6160.89 |        3/2 |   9241.34 |    9241
 18 |  9241.34 |        3/2 |  13862.00 |   13862
 19 | 13862.00 |        3/2 |  20793.01 |   20793
 20 | 20793.01 |        3/2 |  31189.51 |   31189
 21 | 31189.51 |        3/2 |  46784.26 |   46784
 22 | 46784.26 |        3/2 |  70176.40 |   70176
 23 | 70176.40 |        3/2 | 105264.59 |  105264
----+----------+------------+-----------+---------
 24 |         (hard-coded)       196560 |  196560
f=(n,k=2)=>--n?f(n,n<23?k*24/(17+~'48443223'[n]):3.7346):k|0

Try it online!

f=(n,k=2)=>n<24?--n?f(n,k*24/(17+~'_8443223'[n])):~~k:196560

Try it online!

How?

The last term \$a_{24}=196560\$ is hard-coded.

All other terms are computed recursively, using:

$$\begin{cases}a_1=2\\a_{n+1}=a_n\times\dfrac{24}{q_n}\end{cases}$$

where \$q_n\$ is defined as:

$$\begin{cases}q_1=8\\q_2=12\\q_3=12\\q_4=13\\q_5=14\\q_6=14\\q_7=13\\q_n=16,n>7\end{cases}$$

leading to the following ratios:

$$3,2,2,\frac{24}{13},\frac{12}{7},\frac{12}{7},\frac{24}{13},\frac{3}{2},\frac{3}{2},\ldots,\frac{3}{2}$$

The final result is eventually floored and returned.

Results summary

Approximated results are given with 2 decimal places.

  n |   a(n-1) | multiplier |      a(n) | floored
----+----------+------------+-----------+---------
  1 |      n/a |        n/a |         2 |       2
----+----------+------------+-----------+---------
  2 |        2 |          3 |         6 |       6
  3 |        6 |          2 |        12 |      12
  4 |       12 |          2 |        24 |      24
  5 |       24 |      24/13 |     44.31 |      44
  6 |    44.31 |       12/7 |     75.96 |      75
  7 |    75.96 |       12/7 |    130.21 |     130
  8 |   130.21 |      24/13 |    240.39 |     240
  9 |   240.39 |        3/2 |    360.58 |     360
 10 |   360.58 |        3/2 |    540.87 |     540
 11 |   540.87 |        3/2 |    811.31 |     811
 12 |   811.31 |        3/2 |   1216.97 |    1216
 13 |  1216.97 |        3/2 |   1825.45 |    1825
 14 |  1825.45 |        3/2 |   2738.17 |    2738
 15 |  2738.17 |        3/2 |   4107.26 |    4107
 16 |  4107.26 |        3/2 |   6160.89 |    6160
 17 |  6160.89 |        3/2 |   9241.34 |    9241
 18 |  9241.34 |        3/2 |  13862.00 |   13862
 19 | 13862.00 |        3/2 |  20793.01 |   20793
 20 | 20793.01 |        3/2 |  31189.51 |   31189
 21 | 31189.51 |        3/2 |  46784.26 |   46784
 22 | 46784.26 |        3/2 |  70176.40 |   70176
 23 | 70176.40 |        3/2 | 105264.59 |  105264
----+----------+------------+-----------+---------
 24 |         (hard-coded)       196560 |  196560
1
source | link