Proof of Theorem A in A238005.

N. J. A. Sloane

Sep 11 2021, based mostly on emails from Don Reble, Sep 07 2021. 

This theorem was conjectured by Omar E. Pol in February 2018, and proved independently by William J. Keith and Roland Bacher on Sep 05 2021. 
The elegant proof given here is due to Don Reble.

Theorem A. a(n) = b(n) - c(n), where b(n) is the inverse triangular number sequence A003056, that is, b(n) is the maximal i such that T_i <= n, and c(n) is the number of partitions of n into consecutive parts = number of odd divisors of n = A001227(n).

Notation. Note that partitions into distinct parts are also called strict partitions.  Here T(n) = n*(n+1)/2 = A000217(n) denotes the n-th triangular number.

Proof:
The starting point is the key observation made by Don Reble that a(n) is the number of strict partitions of n into "nearly consecutive parts", that is, the number of ways to write n as a sum of terms i, i+1, i+2, ..., i+k (i>=1, k>=2) where one of the interior parts i+1, i+2, ..., i+k-1 is missing. Examples of nearly consecutive partitions (corresponding to the initial nonzero values of a(n)) are 13, 24, 124, 134, 35, 235, 46, ... . 

We will show that b(n) = a(n) + c(n) for all n >= 1.
The proof is by induction on n. It is a simple calculation to verify the result for small n.

Let S(n) denote the set of strict partitions of n into consecutive or nearly consecutive parts, and let |S(n)| denote the cardinality of S(n).  By definition |S(n)| = a(n) + c(n). The theorem will follow if we show that |S(n)| = b(n) = A003056(n).

Define a map f from S(n) to S(n+1) as follows. Take pi \in S(n). If pi is a partition into consecutive parts, increase the largest part by 1. If pi is a partition into nearly consecutive parts, increase the part just below the gap by 1. 

Define a map g from S(n+1) to S(n) as follows. Take pi \in S(n+1). If pi is a partition into consecutive parts, not of the form 1+2+3+...+k for some k, decrease the smallest part by 1. If pi is a partition into nearly consecutive parts, decrease the part just above the gap by 1. 

The pair f,g define a bijection between S(n) and S(n+1) except when n+1 is a triangular number T_k, when S(n+1) contains one more partition than S(n), namely 1+2+3+...+k, which has no inverse under g, since 0 is not a legal part.

It follows that 

|S(n+1)| = |S(n)| unless n+1 is a triangular number, in which case |S(n+1)| = |S(n)| + 1.

But this is also the recurrence that defines b(n) = A003056(n).  QED

The same argument also shows that S(n) contains a unique partition of size z for all 1 <= z <= b(n).

The following explicit construction for such a partition is due to Roland Bacher. 

Let L = [1,2,3,...,z], a list with sum Y = T_z <= T_{b(n)} <= n.

Let n-Y = q*z + r, where 0 <= r < z. To get the desired partition of n, add q to all the terms of L and add 1 to the r largest terms. The sum is now Y + (n-Y) = n. This is consecutive if R=0, otherwise nearly consecutive.