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.

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

This page as a plain text file.
%I A099244 #40 Jul 27 2025 08:48:23
%S A099244 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,
%T A099244 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,
%U A099244 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
%N A099244 Greatest common divisor of length of n in binary representation and its number of ones.
%C A099244 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
%H A099244 Reinhard Zumkeller, <a href="/A099244/b099244.txt">Table of n, a(n) for n = 1..10000</a>
%H A099244 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>.
%F A099244 a(n) = gcd(A070939(n), A000120(n)).
%F A099244 a(A000225(n)) = n and a(m) < n for m < A000225(n).
%t A099244 a[n_] := GCD[BitLength[n], DigitCount[n, 2, 1]]; Array[a, 100] (* _Amiram Eldar_, Jul 16 2023 *)
%o A099244 (Haskell)
%o A099244 a099244 n = gcd (a070939 n) (a000120 n)
%o A099244 -- _Reinhard Zumkeller_, Oct 10 2013
%o A099244 (Python)
%o A099244 from math import gcd
%o A099244 def a(n): b = bin(n)[2:]; return gcd(len(b), b.count('1'))
%o A099244 print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Jun 17 2021
%o A099244 (PARI) a(n) = {my(b = binary(n)); gcd(#b, vecsum(b));} \\ _Amiram Eldar_, Jul 26 2025
%Y A099244 Cf. A000120, A000225, A007088, A070939, A099245, A099246, A099247, A099248, A099249.
%K A099244 base,easy,nonn
%O A099244 1,3
%A A099244 _Reinhard Zumkeller_, Oct 08 2004