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.

A328176 a(n) is the maximal value of the expression d AND (n/d) where d runs through the divisors of n and AND denotes the bitwise AND operator.

Original entry on oeis.org

1, 0, 1, 2, 1, 2, 1, 0, 3, 0, 1, 2, 1, 2, 1, 4, 1, 2, 1, 4, 3, 2, 1, 4, 5, 0, 1, 4, 1, 4, 1, 0, 3, 0, 5, 6, 1, 2, 1, 0, 1, 6, 1, 2, 3, 2, 1, 4, 7, 0, 1, 4, 1, 2, 1, 4, 3, 0, 1, 4, 1, 2, 1, 8, 5, 2, 1, 2, 3, 4, 1, 8, 1, 0, 5, 2, 3, 4, 1, 8, 9, 0, 1, 6, 1, 2, 1
Offset: 1

Views

Author

Rémy Sigrist, Oct 06 2019

Keywords

Examples

			For n = 12:
- we have the following values:
    d   12/d  d AND (12/d)
    --  ----  ------------
     1    12             0
     2     6             2
     3     4             0
     4     3             0
     6     2             2
    12     1             0
- hence a(12) = max({0, 2}) = 2.
		

Crossrefs

See A328177 and A328178 for similar sequences.

Programs

  • Maple
    a:= n-> max(map(d-> Bits[And](d, n/d), numtheory[divisors](n))):
    seq(a(n), n=1..100);  # Alois P. Heinz, Oct 09 2019
  • PARI
    a(n) = vecmax(apply(d -> bitand(d, n/d), divisors(n)))

Formula

a(n)^2 <= n with equality iff n is a square.
a(n) = 1 for any odd prime number p.
a(n) <= A327987(n).
a(n) = 0 iff n belongs to A327988.