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-2 of 2 results.

A381934 a(n) is the least k > 1 such that the binary expansions of n and n*k have the same number of nonleading zeros.

Original entry on oeis.org

2, 3, 3, 5, 3, 6, 5, 9, 3, 5, 6, 5, 5, 19, 9, 17, 3, 5, 5, 3, 6, 9, 5, 11, 5, 7, 19, 301, 9, 35, 17, 33, 3, 5, 5, 3, 5, 5, 3, 3, 6, 5, 9, 5, 5, 17, 11, 305, 5, 7, 7, 15, 19, 3, 301, 9, 9, 71, 35, 13, 17, 67, 33, 65, 3, 5, 5, 3, 5, 5, 3, 3, 5, 10, 5, 10, 3, 6
Offset: 0

Views

Author

Rémy Sigrist, Mar 10 2025

Keywords

Comments

This sequence is well defined (see A381935).

Examples

			The first terms, alongside the binary expansions of n and n*a(n), are:
  n   a(n)  bin(n)  bin(n*a(n))
  --  ----  ------  -----------
   0     2       0            0
   1     3       1           11
   2     3      10          110
   3     5      11         1111
   4     3     100         1100
   5     6     101        11110
   6     5     110        11110
   7     9     111       111111
   8     3    1000        11000
   9     5    1001       101101
  10     6    1010       111100
  11     5    1011       110111
  12     5    1100       111100
  13    19    1101     11110111
  14     9    1110      1111110
  15    17    1111     11111111
  16     3   10000       110000
		

Crossrefs

Programs

  • PARI
    \\ See Links section.

Formula

a(2^n) = 3.
a(2^n - 1) = 2^n + 1.

A340349 a(n) is the smallest k such that A292849(k) = 2n-1.

Original entry on oeis.org

1, 3, 13, 5, 57, 35, 21, 9, 241, 219, 49, 45, 169, 83, 73, 17, 993, 59, 941, 53, 3197, 51, 185, 93, 209, 81, 349, 85, 41, 89, 105, 33, 4033, 491, 4749, 247, 449, 227, 429, 363, 3249, 401, 193, 259, 233, 107, 117, 189, 697249, 1355, 173, 517, 473, 1091, 101, 231, 725, 305
Offset: 1

Views

Author

Thomas Scheuerle, Jan 05 2021

Keywords

Comments

This implies that a(n)=k is a solution to A000120(2*n-1) = A000120((2*n-1)*k), where A000120 is the Hamming weight. If no such number exists we define a(n) = 2.
Does this sequence consist only of odd numbers? It appears so.
This will be the case if A292849 contains all odd numbers, because a(n) will then never become 2.
A292849 must contain all odd numbers if two conditions are satisfied:
First: For every odd number 2n-1 there must be an odd k > 1 that satisfies A000120(2n-1) = A000120((2n-1)*k). To prove that this condition is satisfied, it may be helpful that if k*m = 2^j+r, we know that A000120(k*m) = A063787(r) and for each Hamming weight there exists an r such that A063787(r) = A063787(r+1). This allows us to choose r such that the Hamming weight becomes A000120(m) = A063787(r). For a given r, k*m = 2^j+r may have no solutions if k or m are divisors of r, but there may still exist a solution for k*m = 2^j+r+1. Of course this is not a complete proof.
Second: For every n there needs to be a number k such that 2n-1 is the smallest solution to A000120(2n-1) = A000120((2n-1)*k). This is satisfied if no row in A340441 is a subset of a previous row.
No odd number can appear more than once in this sequence, but not all odd numbers will appear, so this sequence is not a permutation of the odd numbers.
This sequence can be constructed from A340441. Start with a(1) = 1, then a(n) is the least number in row n-1 of A340441 that has not already appeared in A340441.

Crossrefs

Cf. A000120, A292849, A340069, A263132, A077459, A295827, A340441, A340351 table of multiplications.

Programs

  • MATLAB
    function a = A340349(maxA292849)
    c = A340351(maxA292849,1);
    n = 1; run = 1;
    while run == 1
         i = find(c==(n*2)-1);
         if ~isempty(i);
             a(n) = i(1);
             n = n+1;
         else
             run = 0;
         end
    end
    end
    function a = A340351(max_n,max_m)
        for n = 1:max_n
            m = 1; k = 1;
            while m < max_m+1
                c = length(find(bitget(k,1:32)== 1));
                if c == length(find(bitget(n*k,1:32)== 1))
                    a(n,m) = k;
                    m = m+1;
                end
                k = k +1;
            end
        end
    end
    
  • PARI
    f(n) = my(k=1); while ((hammingweight(k)) != hammingweight(k*n), k++); k; \\ A292849
    a(n) = my(k=1); while(f(k) != 2*n-1, k++); k; \\ Michel Marcus, Jan 09 2021
Showing 1-2 of 2 results.