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.

A348480 For numbers x_n coprime to 10 there exist infinitely many binary numbers b such that gcd(b,rev(b)) = x_n and digitsum(b) = x_n. a(n) is the smallest b converted to decimal that satisfies this constraint.

Original entry on oeis.org

1, 11, 4399137296449, 767, 4543829, 302306413101798081695809, 1041919, 4120511, 119471087, 92239871, 461373439, 3221191679, 25098711039, 5864072675327, 2642508222647189060948556167549513, 20016007615544303, 208836273045503, 70085007900671, 985162418485119
Offset: 1

Views

Author

Ruediger Jehn, Oct 20 2021

Keywords

Comments

Only for numbers x_n coprime to 10 (A045572, i.e., numbers ending with 1,3,7 or 9) do there exist binary numbers b such that gcd(b, rev(b)) = x_n and digitsum(b) = x_n. For the numbers 7 and 13 and the porous numbers 11, 37 and 101 (A337832), the terms in their binary form have more zeros than ones, which are called long solutions. In these cases, let e = mult_order(10, n), then b = 10^(e*n) + Sum_{i=0..n-2} 10^(e*i). For example, the multiplicative order of 10 mod 11 is 2 and 10001010101010101010101 is the solution. However, in the case of the porous number 121, this formula does not work because both b and rev(b) are divisible by 1111111111111111111111 which also has a multiplicative order of 10 = 22 like 121 and therefore two extra zeros need to be inserted.
For most numbers short solutions exist. Which numbers have a short solution and which have a long solution is still unclear.
For clarification: in gcd(1011,1101)=3 the two numbers 1011 and 1101 are base-10 numbers, but then 1011 is interpreted as a base-2 number and translated back to base 10 to get a(2)=11 (=8+2+1).

Examples

			x_2 = 3. a(2)=11 which in binary is 1011. gcd(1011,1101)=3 and there is no smaller binary number that satisfies this constraint.
x_4 = 9. a(4)=767 which in binary is 1011111111. gcd(1011111111,1111111101)=9 and there is no smaller binary number that satisfies this constraint.
		

Crossrefs

Programs

  • PARI
    xx(n) = 2*n - 1 + (n+1)\4 * 2; \\ A045572
    gcdr(n) = my(b=binary(n)); gcd(fromdigits(Vecrev(b), 10), fromdigits(b, 10));
    a(n) = my(b=1, x=xx(n)); while ((hammingweight(b) != x) || (gcdr(b) != x), b++); b; \\ Michel Marcus, Dec 01 2021
    
  • Python
    from sympy.utilities.iterables import multiset_permutations
    from itertools import count
    from math import gcd
    def A348480(n):
        if n == 1: return 1
        xn = 2*(n+(n+1)//4) - 1
        for l in count(xn-1):
            for d in multiset_permutations(['0']*(l-xn+1)+['1']*(xn-1)):
                s = '1'+''.join(d)
                if gcd(int(s),int(s[::-1])) == xn:
                    return int(s,2) # Chai Wah Wu, Jan 08 2022

Extensions

a(13) from Giorgos Kalogeropoulos, Oct 22 2021
a(14) from Pontus von Brömssen, Oct 23 2021
a(15) from Ruediger Jehn, Dec 01 2021
a(16) - a(29) from Ruediger Jehn, Dec 17 2021
a(30) - a(54) from Ruediger Jehn, Jan 11 2022

A350385 Minimum number of zeros that need to be added to x_n ones such that a combination of these zeros and ones can make a number b with the property gcd(b, rev(b)) = digitsum(b) = x_n where x_n is coprime to 10.

Original entry on oeis.org

0, 1, 36, 1, 12, 66, 3, 3, 6, 4, 2, 3, 4, 10, 75, 16, 7, 3, 3, 7, 2, 5, 4, 3, 3, 6, 2, 2, 2, 10, 10, 5, 2, 3, 2, 2, 2, 4, 3, 10, 304, 4, 3, 3, 1, 3, 12, 6, 124
Offset: 1

Views

Author

Ruediger Jehn, Jan 05 2022

Keywords

Comments

Only for numbers x_n coprime to 10 (A045572, i.e., numbers ending with 1,3,7 or 9) do there exist numbers b such that gcd(b, rev(b)) = x_n and digitsum(b) = x_n (rev(b) is the digit reversal of b, e.g., rev(123) = 321). If b must consist only of zeros and ones, the smallest values of b that satisfy these two constraints are converted to decimal and form sequence A348480. The question arose: How many zeros are needed for each x_n to find a matching number b? In most cases just a few zeros are enough, but some numbers, such as 7, 11, 13 and 37, require more zeros than ones and the corresponding b is called a "long solution". x_n = 101 requires 304 zeros because 101 is a porous number (see A337832).

Examples

			a(2) = 1 because x_2 = 3 and if you add 1 zero to 3 ones you can form b = 1011 for which gcd(b,rev(b)) = digitsum(b) = 3.
		

Crossrefs

Programs

  • Python
    A348480 = [1, 11, 4399137296449, 767, 4543829, 302306413101798081695809]
    for m in A348480:
        print(bin(m)[2:].count('0'))
Showing 1-2 of 2 results.