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.

A327987 a(n) = Sum_{d|n} d & (n/d), where & is the bitwise AND operator, with a(0) = 0.

Original entry on oeis.org

0, 1, 0, 2, 2, 2, 4, 2, 0, 5, 0, 2, 4, 2, 4, 4, 4, 2, 4, 2, 12, 8, 4, 2, 8, 7, 0, 4, 12, 2, 16, 2, 0, 8, 0, 12, 10, 2, 4, 4, 0, 2, 16, 2, 4, 10, 4, 2, 8, 9, 0, 4, 12, 2, 8, 4, 8, 8, 0, 2, 24, 2, 4, 6, 8, 12, 8, 2, 4, 8, 16, 2, 24, 2, 0, 14, 4, 8, 16, 2, 24, 17
Offset: 0

Views

Author

Peter Luschny, Oct 11 2019

Keywords

Crossrefs

Cf. A327988 (zeros), A327989, A016754.

Programs

  • Julia
    using IntegerSequences
    vcat([0], [V327987(n) for n in 1:81]) |> println  # Peter Luschny, Sep 25 2021
  • Magma
    [0] cat [&+[BitwiseAnd(d,n div d):d in Divisors(n)]:n in [1..90]]; // Marius A. Burtea, Oct 11 2019
    
  • Maple
    A327987 := n -> add(Bits:-And(d, n/d), d=numtheory:-divisors(n)):
    seq(A327987(n), n=0..81);
  • Mathematica
    divisors[0] := {}; divisors[n_] := Divisors[n];
    a[n_] := Total[Table[BitAnd[d , n/d], {d, divisors[n]}]] ;
    Table[a[n], {n, 0, 81}]
  • PARI
    a(n) = if (n, sumdiv(n, d, bitand(d, n/d)), 0); \\ Michel Marcus, Oct 11 2019
    
  • Sage
    def a(n): return sum(d & n//d for d in divisors(n)) if n > 0 else 0
    print([a(n) for n in (0..81)])
    

Formula

a(n) is odd if and only if n is an odd square (A016754).

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.

A327989 Nonnegative integers k such that Sum_{d|k} k & (k/d) is an odd prime, where & is the bitwise AND operator.

Original entry on oeis.org

9, 25, 81, 121, 289, 625, 729, 841, 1681, 3249, 3481, 5041, 7225, 8281, 8649, 9025, 10201, 11449, 13689, 15129, 18769, 19881, 22201, 25281, 27225, 28561, 29241, 31329, 32041, 33489, 34225, 36481, 38025, 38809, 42849, 46225, 48841, 51529, 53361, 55225, 56169, 57121
Offset: 1

Views

Author

Peter Luschny, Oct 11 2019

Keywords

Comments

A subsequence of the odd squares A016754.

Crossrefs

Programs

  • Magma
    [k:k in [1..60000]|IsOdd(a) and IsPrime(a) where a is &+[BitwiseAnd(d,k div d):d in Divisors(k)]]; // Marius A. Burtea, Oct 11 2019
  • Maple
    select(k -> (A327987(k) <> 2 and isprime(A327987(k))), [$0..60000]);
Showing 1-3 of 3 results.