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.

A099244 Greatest common divisor of length of n in binary representation and its number of ones.

Original entry on oeis.org

1, 1, 2, 1, 1, 1, 3, 1, 2, 2, 1, 2, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 2, 2, 3, 2, 3, 3, 2, 2, 3, 3, 2, 3, 2, 2, 1, 2, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 08 2004

Keywords

Comments

For k >= 2, n in the range [2^(k-1)..2^k - 2] have binary length k but fewer than k 1's, thus a(n) is a proper divisor of k, and if k is a prime then a(n) = 1. - Ctibor O. Zizka, Jun 19 2021

Crossrefs

Programs

  • Haskell
    a099244 n = gcd (a070939 n) (a000120 n)
    -- Reinhard Zumkeller, Oct 10 2013
    
  • Mathematica
    a[n_] := GCD[BitLength[n], DigitCount[n, 2, 1]]; Array[a, 100] (* Amiram Eldar, Jul 16 2023 *)
  • PARI
    a(n) = {my(b = binary(n)); gcd(#b, vecsum(b));} \\ Amiram Eldar, Jul 26 2025
  • Python
    from math import gcd
    def a(n): b = bin(n)[2:]; return gcd(len(b), b.count('1'))
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jun 17 2021
    

Formula

a(n) = gcd(A070939(n), A000120(n)).
a(A000225(n)) = n and a(m) < n for m < A000225(n).

A099246 Denominator of relative frequency of number of ones in the binary representation of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 08 2004

Keywords

Crossrefs

Cf. A000120, A000225, A007088, A070939, A099244, A099245 (numerators).

Programs

  • Haskell
    import Data.Ratio ((%), denominator)
    a099246 n = denominator $ (a000120 n) % (a070939 n)
    -- Reinhard Zumkeller, Oct 10 2013
  • Mathematica
    a[n_] := Denominator[First[#]/Total[#]] & @ DigitCount[n, 2, {1, 0}]; Array[a, 100, 0] (* Amiram Eldar, Apr 05 2025 *)

Formula

a(n)*A000120(n) = A099245(n)*A070939(n).
a(n) = A070939(n)/A099244(n) for n > 0.
a(n) = 1 iff n = A000225(k).
a(n) = if n=0 then 1 else A070939(n)/GCD(A070939(n), A000120(n)).

A293198 a(n) is the least positive k such that f(k) = f(k + n) where f(k) = A000120(k) / A070939(k).

Original entry on oeis.org

1, 5, 1, 9, 3, 21, 1, 2, 2, 19, 2, 38, 3, 37, 1, 33, 15, 35, 38, 37, 84, 35, 76, 12, 7, 10, 9, 10, 3, 4, 1, 10, 4, 2, 5, 2, 2, 6, 5, 2, 2, 5, 2, 9, 4, 6, 5, 2, 2, 5, 2, 6, 5, 5, 2, 5, 7, 137, 138, 134, 3, 133, 1, 129, 63, 131, 134, 133, 140, 131, 138, 137, 152, 139, 134, 133, 148, 131, 146, 56, 336, 135, 150, 52
Offset: 0

Views

Author

Altug Alkan, Oct 05 2017

Keywords

Comments

Numbers m such that a(2^m*(2^(m + 1) - 1) + 1) = 2^m are 0, 1, 2, 3, 4, 5, 6, 8, 9, 11, 14, 15, 18, 20, 21, ...
Numbers t such that a(t) = 2 are 7, 8, 10, 33, 35, 36, 39, 40, 42, 47, 48, 50, ...
Numbers t such that a(t) > t are 0, 1, 3, 5, 9, 11, 13, 15, 17, 18, 19, 20, 21, ...

Examples

			a(5) = 21 because 21 = 2^4 + 2^2 + 2^0, 21 + 5 = 2^4 + 2^3 + 2^1; A000120(21) / A070939(21) = A000120(21 + 5) / A070939(21 + 5) and 21 is the least number with this property.
		

Crossrefs

Programs

  • PARI
    a(n) = {my(k=1); while (hammingweight(k+n)/#binary(k+n) != hammingweight(k) /#binary(k), k++); k;}

Formula

a(n) <> n for all n >= 0.
a(n) <= 5*n for all n >= 1.
a(2^m - 1) = 1 for all m >= 1.
a(2^m - 2^2) = 2^2 - 1 for all m >= 3.
a(2^m - 2^3) = 2^3 - 1 for all m >= 5.
a(2^m - 2^4) = 2^4 - 1 for all m >= 7.
a(2^m - 2^5) = 2^5 - 1 for all m >= 10.
a(2^m - 2^6) = 2^6 - 1 for all m >= 13.
a(2^m - 2^7) = 2^7 - 1 for all m >= 17.
a(2^m - 2^8) = 2^8 - 1 for all m >= 21.
a(2^m - 2^9) = 2^9 - 1 for all m >= 26.
a(2^(p - 1)) = 2^(p - 1) - 1 and a(2^(p - 1) - 1) = 2^p + 1 for all primes p.
a(2^(p - 1) + 1) = 2^p + 3 for all primes p >= 5.
Showing 1-3 of 3 results.