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.

Previous Showing 11-14 of 14 results.

A182336 a(n) is the least m>=n, such that the Hamming distance D(n,m)=4.

Original entry on oeis.org

15, 14, 13, 12, 11, 10, 9, 8, 19, 18, 17, 16, 17, 16, 16, 17, 31, 30, 29, 28, 27, 26, 25, 24, 33, 32, 32, 33, 32, 33, 34, 35, 47, 46, 45, 44, 43, 42, 41, 40, 51, 50, 49, 48, 49, 48, 48, 49, 63, 62, 61, 60, 59, 58, 57, 56, 64, 65, 66, 67, 68, 69, 70, 71, 79, 78, 77, 76, 75, 74
Offset: 0

Views

Author

Vladimir Shevelev, Apr 25 2012

Keywords

Comments

Or (see comment in A206853) a(n)=n<+>4.
Conjecture: for n > 96, n + 1 <= a(n) <= 9n/8 + 1. - Charles R Greathouse IV, Apr 25 2012

Crossrefs

Programs

  • PARI
    hamming(n)=my(v=binary(n));sum(i=1,#v,v[i])
    a(n)=my(k=n);while(hamming(bitxor(n,k++))!=4,);k \\ Charles R Greathouse IV, Apr 25 2012

Extensions

Terms corrected by Charles R Greathouse IV, Apr 25 2012

A334045 Bitwise NOR of binary representation of n and n-1.

Original entry on oeis.org

0, 0, 0, 0, 2, 0, 0, 0, 6, 4, 4, 0, 2, 0, 0, 0, 14, 12, 12, 8, 10, 8, 8, 0, 6, 4, 4, 0, 2, 0, 0, 0, 30, 28, 28, 24, 26, 24, 24, 16, 22, 20, 20, 16, 18, 16, 16, 0, 14, 12, 12, 8, 10, 8, 8, 0, 6, 4, 4, 0, 2, 0, 0, 0, 62, 60, 60, 56, 58, 56, 56, 48, 54, 52, 52
Offset: 1

Views

Author

Christoph Schreier, Apr 13 2020

Keywords

Comments

All terms are even.
a(1) = 0, a(2) = 0, and a(2^n + 1) = 2^n - 2 for n > 0. Are there any other cases where n - a(n) < 4? - Charles R Greathouse IV, Apr 13 2020
The answer to the above question is no. Write n as n = (2m+1)*k, i.e. k = A006519(n) is the highest power of 2 dividing n. If m = 0, a(n) = 0 and n - a(n) = n. If m > 0, then a(n) = 2v*k, where v is the 1's complement of m. Thus n-a(n) = (2(m-v)+1)*k. Since m in binary has a leading 1, m - v >= 1 and thus n - a(n) >= 3 with n - a(n) = 3 when n > 2, k = 1 and m - v = 1, i.e. m is a power of 2 and n is of the form 2^r + 1. - Chai Wah Wu, Apr 13 2020

Examples

			a(11) = 11 NOR 10 = bin 1011 NOR 1010 = bin 100 = 4.
		

Crossrefs

Cf. A038712 (n XOR n-1), A086799 (n OR n-1), A129760 (n AND n-1).

Programs

  • Maple
    a:= n-> Bits[Nor](n, n-1):
    seq(a(n), n=1..100);  # Alois P. Heinz, Apr 13 2020
  • PARI
    a(n) = my(x=bitor(n-1, n)); bitneg(x, #binary(x)); \\ Michel Marcus, Apr 13 2020
  • Python
    def norbitwise(n):
        a = str(bin(n))[2:]
        b = str(bin(n-1))[2:]
        if len(b) < len(a):
            b = '0' + b
        c = ''
        for i in range(len(a)):
            if a[i] == b[i] and a[i] == '0':
                c += '1'
            else:
                c += '0'
        return int(c,2)
    
  • Python
    def A334045(n):
        m = n|(n-1)
        return 2**(len(bin(m))-2)-1-m # Chai Wah Wu, Apr 13 2020
    

A341522 a(n) = A156552(3*A005940(1+n)).

Original entry on oeis.org

2, 5, 6, 11, 10, 13, 14, 23, 18, 21, 22, 27, 26, 29, 30, 47, 34, 37, 38, 43, 42, 45, 46, 55, 50, 53, 54, 59, 58, 61, 62, 95, 66, 69, 70, 75, 74, 77, 78, 87, 82, 85, 86, 91, 90, 93, 94, 111, 98, 101, 102, 107, 106, 109, 110, 119, 114, 117, 118, 123, 122, 125, 126, 191, 130, 133, 134, 139, 138, 141, 142, 151, 146, 149
Offset: 0

Views

Author

Antti Karttunen, Feb 15 2021

Keywords

Comments

Because the least significant 0-bit in A156552-code of any nonzero multiple of 3 is always alone (has 1-bit immediately to its left), it follows that A255068 (= A091067(n+1) - 1) gives these same terms in the ascending order.

Crossrefs

Row/column 2 of A341520. Permutation of A255068.
Cf. A005940, A007814, A156552, A086799, A014707 (characteristic function).

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A156552(n) = { my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res };
    A341522(n) = A156552(3*A005940(1+n));

Formula

a(n) = A156552(3*A005940(1+n)).
From Antti Karttunen, Feb 23 2021: (Start)
a(n) = 1 + n + A086799(1+n). - [Conjectured by LODA-miner, and easily seen to be correct]
a(n) = 1+ 2*n + 2^A007814(1+n). - [As the above can be rewritten to this]
(End)

A381406 a(0) = 0; for n > 0, a(n) is the smallest unused number such that a(n) OR a(n-1) = 2^k - 1, where OR is the binary OR operation and k>=1, while the binary weight of a(n) does not equal that of a(n-1).

Original entry on oeis.org

0, 1, 3, 2, 5, 7, 4, 11, 6, 13, 10, 15, 8, 23, 9, 14, 17, 30, 19, 12, 27, 20, 31, 16, 47, 18, 29, 22, 43, 21, 46, 25, 39, 24, 55, 26, 45, 50, 61, 34, 63, 28, 51, 44, 59, 36, 91, 37, 58, 69, 62, 33, 94, 35, 60, 67, 124, 71, 56, 79, 48, 95, 32, 127, 38, 57, 70, 121, 54, 41, 86, 107, 52, 75, 117, 42, 53, 74, 119, 40, 87, 104, 151, 105, 118, 73, 126, 49, 78, 115
Offset: 0

Views

Author

Scott R. Shannon, Feb 22 2025

Keywords

Comments

The fixed points begin 0, 1, 10, 315, 413, 415, 1551, 1559, 1797; there are likely infinitely more.

Examples

			a(4) = 5 = 101_2 as 5 is unused and a(3) = 2 = 10_2, and 101_2 OR 10_2 = 111_2 = 2^3 - 1, while the binary weights of 5 and 2 are 2 and 1 respectively.
		

Crossrefs

Previous Showing 11-14 of 14 results.