login
Maximal GCD of seven positive integers with sum n.
10

%I #19 Jul 24 2022 13:05:26

%S 1,1,1,1,1,1,1,2,1,2,1,2,1,2,3,2,1,3,1,2,3,4,1,3,1,4,3,2,5,4,1,2,3,5,

%T 1,6,1,4,5,2,1,6,7,5,3,4,1,6,5,8,3,2,1,6,1,2,9,8,5,6,1,4,3,10,1,9,1,2,

%U 5,4,11,6,1,10,9,2,1,12,5,2,3,11,1,10,13,4,3,2,5,12

%N Maximal GCD of seven positive integers with sum n.

%C Also largest divisor <= n/7 of n. - _David A. Corneth_, Jul 24 2022

%H Alois P. Heinz, <a href="/A355402/b355402.txt">Table of n, a(n) for n = 7..5000</a>

%p b:= proc(n, i, t) option remember; `if`(n=0, signum(t),

%p `if`(min(i, t)<1, 1, max(b(n, i-1, t),

%p igcd(b(n-i, min(n-i, i), t-1), i))))

%p end:

%p a:= n-> `if`(n<7, 0, b(n$2, 7)):

%p seq(a(n), n=7..200); # _Alois P. Heinz_, Jul 13 2022

%t b[n_, i_, t_] := b[n, i, t] = If[n == 0, Sign[t],

%t If[Min[i, t] < 1, 1, Max[b[n, i - 1, t],

%t GCD[b[n - i, Min[n - i, i], t - 1], i]]]];

%t a[n_] := If[n < 7, 0, b[n, n, 7]];

%t Table[a[n], {n, 7, 100}] (* _Jean-François Alcover_, Jul 24 2022, after _Alois P. Heinz_ *)

%o (PARI) a(n) = my(d = divisors(n)); d = select(x->x <= n\7,d); d[#d] \\ _David A. Corneth_, Jul 24 2022

%Y Cf. A009641, A355403.

%Y Maximal GCD of k positive integers with sum n for k = 2..10: A032742 (k=2,n>=2), A355249 (k=3), A355319 (k=4), A355366 (k=5), A355368 (k=6), this sequence (k=7), A354598 (k=8), A354599 (k=9), A354601 (k=10).

%K nonn,easy

%O 7,8

%A _Wesley Ivan Hurt_, Jun 30 2022