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).

A099248 Numbers such that length in binary representation and number of ones have a common divisor greater than 1.

Original entry on oeis.org

3, 7, 9, 10, 12, 15, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 60, 63, 127, 129, 130, 132, 135, 136, 139, 141, 142, 144, 147, 149, 150, 153, 154, 156, 159, 160, 163, 165, 166, 169, 170, 172, 175, 177, 178, 180
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 08 2004

Keywords

Crossrefs

Complement of A099247.

Programs

  • Haskell
    a099248 n = a099248_list !! (n-1)
    a099248_list = filter ((> 1) . a099244) [1..]
    -- Reinhard Zumkeller, Oct 10 2013
  • Mathematica
    Select[Range[200], !CoprimeQ[BitLength[#], DigitCount[#, 2, 1]] &] (* Amiram Eldar, Jul 16 2023 *)

Formula

A099244(a(n)) > 1.

Extensions

Corrected by Leroy Quet, Sep 04 2008
a(34) and beyond from Diana L. Mecum, Jan 04 2009

A099249 Number of numbers not greater than n such that length in binary representation and number of ones are coprime.

Original entry on oeis.org

1, 2, 2, 3, 4, 5, 5, 6, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 29, 30, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41
Offset: 1

Views

Author

Reinhard Zumkeller, Oct 08 2004

Keywords

Comments

Number of numbers m <= n such that A099244(m) = 1.

Crossrefs

Programs

  • Haskell
    a099249 n = a099249_list !! (n-1)
    a099249_list = scanl1 (+) $ map ((0 ^) . (subtract 1)) a099244_list
    -- Reinhard Zumkeller, Oct 10 2013
    
  • Mathematica
    Accumulate[Table[Boole[CoprimeQ[BitLength[n], DigitCount[n, 2, 1]]], {n, 1, 100}]] (* Amiram Eldar, Jul 16 2023 *)
  • PARI
    isA099247(k) = {my(b = binary(k)); gcd(#b, vecsum(b)) == 1;}
    list(nmax) = {my(c = 0); for(n = 1, nmax, if(isA099247(n), c++); print1(c, ", "));} \\ Amiram Eldar, Jul 26 2025

Formula

a(n) = Sum_{k=1..n} A063524(A099244(k)). - Reinhard Zumkeller, Oct 10 2013
Showing 1-3 of 3 results.