cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A352178 Let S = {t_1, t_2, ..., t_n} be a set of n distinct integers and consider the sums t_i + t_j (i

Original entry on oeis.org

0, 1, 3, 4, 6, 7, 9, 11, 13, 15, 17, 19, 21, 24, 26, 29, 31, 34, 36, 39, 41
Offset: 1

Views

Author

N. J. A. Sloane, Mar 07 2022

Keywords

Comments

Given distinct integers t_1, ..., t_n, form a graph G with n vertices labeled by the t_i, and with an edge from t_i to t_j, labeled t_i + t_j, whenever t_i + t_j is a power of 2.
See the Pratt link for the best lower bounds known, and examples of sets achieving these bounds, for 1 <= n <= 100. - N. J. A. Sloane, Sep 26 2022
The following remarkable theorem is due to M. S. Smith (email of Mar 06 2022).
Theorem: G contains no 4-cycles.
Proof. Suppose the contrary, and assume the vertices t_1, t_2, t_3, t_4 form a 4-cycle, with edges labeled b_1 = t_1+t_2, b_2 = t_2+t_3, b_3 = t_3+t_4, b_4 = t_4+t_1. The b_i are powers of 2.
Since the t_i are distinct, b_1 != b_4, b_2 != b_1, b_3 != b_2, and b_4 != b_3.
We also have
(*) b_1+b_3 = b_2+b_4 = t_1+t_2+t_3+t_4.
However, the powers of 2 form a Sidon set (all pairwise sums are distinct), so (*) implies that either b_1=b_2 and b_3=b_4 or b_1=b_4 and b_3=b_2, both of which are impossible. QED
Let c(n) = A006855(n) denote the maximum number of edges in a graph on n nodes containing no 4-cycle.
Corollary: a(n) <= c(n).
The values of c(n) agree with the lower bounds on a(n) for n <= 9 (see A347301), which establishes the first 9 values of a(n).
Another corollary is that a(n) is bounded asymptotically by (n/4)*(sqrt(4n-3)+1) (see A006855).
The theorem is remarkable, since before the only known values of a(n) were the trivial values for n <= 3.
In summary, we have a(n) >= A347301(n) for n >= 6, and
a(n) <= A006855(n) for all n.
From Thomas Scheuerle, Sep 23 2022: (Start)
Subgraphs of G consisting only of edges between positive numbers are free from any cycles. Proof: If b + c = 2^t then either (b-1)XOR(c) or (b)XOR(c-1) will be 2^t-1. The properties of XOR allow in this case only a chain for Sidon sets. (XOR means bitwise exclusive or).
From this we can conclude that all cycles in the graph G must contain at least one negative number.
Conjecture A: The count of negative numbers in an optimal solution is either equal to the count of positive numbers or one less.
This leads to Conjecture B: a(n) <= floor((n+1)*3/2). (End)
Max Alekseyev points out that both conjectures are wrong.
(A) Counterexamples are given by examples from A347301:
a(12) = 19: { -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13 }
a(13) = 21: { -11, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15 }
(B) For n=14, this bound is 22, but it is smaller than a(14) = 24. N. J. A. Sloane, Sep 25 2022

Examples

			a(3) = 3 from S = {-1, 3, 5}.
a(4) >= 4 from S = {-3, -1, 3, 5}, a(4) <= A006855(4) = 4, so a(4) = 4.
a(5) >= 6 from S = {-3, -1, 3, 5, 11},  a(5) <= A006855(5) = 6, so a(5) = 6.
From _Thomas Scheuerle_, Sep 26 2022: (Start)
a(13): { -11, -7, -5, -3, -1, 1, 3,  5,  7,  9, 11, 13, 15 }
      13
      |
9-7-1-3-5-11
    |
    15  -> Four loose ends k = 4. Eight positive numbers p = 8.
a(13) = 21 < (p-1) + (n-p)*k
a(10): {-9, -5, -3, -1, 3, 5, 7, 9, 11, 13}
  13-3-5-11  7-9 -> Two times two loose ends k = 4. Six positive numbers p = 6.
a(10) = 15 < (p-1) + (n-p)*k
(End)
		

References

  • M. S. Smith, Email to N. J. A. Sloane, Mar 06 2022.

Crossrefs

Formula

a(n) <= (p-1) + (n-p)*k. k is the count of loose ends of the subgraphs of positive numbers. Subgraphs means here the biggest sets of positive numbers connected by sums which are equal to a power of two. There may be multiple such sets which are not interconnected directly. From observation it appears that a(n) <= (p-1) + (n-p)*(k-1) does hold in most cases. - Thomas Scheuerle, Sep 26 2022
For n > 2, a(n) <= floor(a(n-1) * n / (n-2)). - Max Alekseyev, Jan 23 2023

Extensions

a(10) from Matthew Bolan, Sep 22 2022 - see link. - N. J. A. Sloane, Sep 22 2022
Edited by N. J. A. Sloane, Sep 22 2022
a(12)-a(18) from Max Alekseyev, Sep 25 2022, Sep 29 2022
a(19)-a(20) from Max Alekseyev, Dec 02 2023
a(21) from Max Alekseyev, May 01 2024

A357409 a(n) is the maximum number of positive numbers in a set of n consecutive positive or negative odd numbers such that the number of pairs that add to a power of 2 is maximal.

Original entry on oeis.org

1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39
Offset: 1

Views

Author

Thomas Scheuerle, Sep 26 2022

Keywords

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.

Examples

			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.
		

Crossrefs

Programs

  • 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

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.

A357574 a(n) is the maximum number of pairs that sum to a power of 2 in a set of n consecutive odd numbers.

Original entry on oeis.org

0, 1, 2, 4, 5, 7, 9, 11, 13, 15, 17, 19, 21, 24, 26, 29, 31, 34, 36, 39, 41, 44, 46, 49, 51, 54, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 101, 104, 107, 110, 113, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 150, 153, 157, 160, 164, 167
Offset: 1

Views

Author

Thomas Scheuerle, Oct 04 2022

Keywords

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.
Conjecture: a(n+1) - a(n) = k, if n is even then A129868(k-1) < n < A129868(k), if n is odd then A020515(k) <= n < A020515(k+1).

Examples

			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.
		

Crossrefs

Programs

  • 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

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.

Extensions

Edited by Max Alekseyev, Mar 09 2023
Showing 1-3 of 3 results.