login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A366066
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.
1
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, 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9
OFFSET
0,4
COMMENTS
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.
Runs with length >= 2 start at numbers k^2 - 1 (k >= 2).
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.
FORMULA
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).
EXAMPLE
For n = 11, 1+2+3+5=11; so a(11) = 4.
For n = 12, 1+4+7=12; so a(12) = 3.
PROG
(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;
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Yifan Xie, Sep 28 2023
STATUS
approved