OFFSET
1,3
COMMENTS
An optimal set delivering a(n) pairs summing to powers of 2 can be formed by n-A357409(n) first negative odd numbers and A357409(n) first positive odd numbers, that is, by the odd numbers in the interval [-2*(n-A357409(n))+1, 2*A357409(n)-1].
a(n) is in many cases equal to A347301(n) but there are some deviations: a(3) = 2 but A347301(3) = 3, a(29) = 62 but A347301(29) = 61, a(31) = 68 but A347301(32) = 67, a(33) = 74 but A347301(33) = 73, ... . Hence it appears that a(n) may be used as an improved lower bound for A352178(n) in many cases.
LINKS
Max A. Alekseyev, Maximizing the number of integer pairs summing to powers of 2 via graph labeling and solving restricted systems of linear (in)equations, J. Comp. Sys. Sci. 157 (2026), 103735. Preprint: arXiv:2303.02872 [math.CO], 2023-2025.
Thomas Scheuerle, a(n+1) - a(n) for n = 1..500
FORMULA
a(n) <= A352178(n).
a(n) >= n-1. This would be the maximum value that could be attained for a set of only positive odd numbers and size n.
EXAMPLE
a(5) = 5 because A357409(5) = 4, for which the corresponding set {-1, 1, 3, 5, 7} produces 5 powers of 2: 1+3, 1+7, 3+5, 3-1, 5-1.
PROG
(MATLAB)
function a = A357574( max_n )
a(1) = 0; 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) = c;
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, Oct 04 2022
EXTENSIONS
Edited by Max Alekseyev, Mar 09 2023
STATUS
approved
