OFFSET
1,2
COMMENTS
For this sequence we check the sums for all possible pairs between two distinct members of a set of consecutive odd numbers, we count as valid results of the form 2^m, valid sums are obviously >= 1.
The related sequence A357574 counts the pairs that add to a power of 2.
For sequences of consecutive odd numbers the maximum number of pairs that add to a power of 2 will never be obtained if the sequence starts with numbers greater than 1. Obviously for sequences of all negative numbers, we will not obtain any valid pair.
It appears likely that an optimal solution for A352178 will contain only odd numbers as a mix of odd and even numbers would lead to two unconnected graphs. Let us now assume A352178(k) has an optimal solution in odd numbers only, then there exists a least m such that a(k+m) uses a superset of the same solution pairs used in A352178(k). It would be interesting to know if m has a bound in relation to k.
LINKS
FORMULA
Conjecture: a(n) = A274089(n) + 2^t - 1, where t is the number of solutions k > 0 to the inequality n >= 2^(2*(k+1) + 1) - 2^(k+1) - 1. For n < 27, (2^t - 1) is 0, it is 1 for 27 <= n < 119, and it is 3 for 119 <= n < 495.
EXAMPLE
a(5) = 4 because {1, 3, 5, 7, 9} has four valid pairs: 1+3, 1+7, 3+5, 7+9. But {-1, 1, 3, 5, 7} has only four positive numbers and five valid pairs: 1+3, 1+7, 3+5, 3-1, 5-1, and there is no other set of consecutive numbers with 4 sums being a power of 2.
PROG
(MATLAB)
function a = A357409( max_n )
a(1) = 1; q = [];
for n = 1:max_n
c = 0;
for k = 0:n
s = (2*([0:n]-k))+1;
r = countpowtwo(s);
if c < r
c = r;
q = s;
end
end
a(n+1) = length(find(q > 0));
end
end
function c = countpowtwo(s)
M = repmat(s, [length(s), 1]);
M = M+M';
M(M<=0) = 7;
M = bitand(M, M-1);
M = M + eye(size(M));
c = length(find(M == 0))/2;
end
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Scheuerle, Sep 26 2022
STATUS
approved