%I #36 Dec 31 2023 13:25:22
%S 0,1,1,2,2,2,3,2,3,3,3,4,3,4,3,4,4,4,5,4,5,4,5,4,5,5,5,5,5,6,5,6,5,6,
%T 5,6,6,6,6,6,6,6,7,6,7,6,7,6,7,7,7,7,7,7,7,7,7,7,7,8,7,8,7,8,8,8,8,8,
%U 8,8,8,8,8,8,8,8,8,8,9,8,9,9,9,9,9,9,9
%N a(n) is the largest positive integer k such that n can be expressed as the sum of k distinct positive integers that are coprime to each other.
%C The indices at which k first appears, for k >= 0: 1, 3, 6, 11, 18, 29, 42, 59, 78 (A014284). Such n's are expressed as the sum of 1 and the first primes.
%C Runs with length >= 2 start at numbers k^2 - 1 (k >= 2).
%C If there are terms between runs of k and k+1, these two numbers occur alternately. Suppose that m is such a term that is b(m) terms after the first occurrence of k+1; if b(m) is odd, there are at least two even numbers in the expression of n as the sum of k+1 integers, which are not coprime to each other, so a(m) = k.
%H Yifan Xie, <a href="/A366066/b366066.txt">Table of n, a(n) for n = 0..9999</a>
%F a(n) = A083375(n) - 1 if and only if n = 7, 12, 14, 19, 21, 23, 30, 32, 34, 43, 45, 47, 60, 62, 79; otherwise, a(n) = A083375(n).
%e For n = 11, 1+2+3+5=11; so a(11) = 4.
%e For n = 12, 1+4+7=12; so a(12) = 3.
%o (PARI) lista(nn) = v=[0]; f=[7, 12, 14, 19, 21, 23, 30, 32, 34, 43, 45, 47, 60, 62, 79]; for(n=1, nn, for(i=1, prime(n), v=concat(v, n))); for(n=1, 15, v[f[n]+1]=v[f[n]+1]-1); v;
%Y Cf. A000040, A000290, A014284, A083375.
%K nonn,easy
%O 0,4
%A _Yifan Xie_, Sep 28 2023