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.

A089226 Smallest composite number with exactly n 1's in binary representation.

This page as a plain text file.
%I A089226 #15 Dec 16 2021 07:36:41
%S A089226 4,6,14,15,55,63,247,255,511,1023,2047,4095,12287,16383,32767,65535,
%T A089226 196607,262143,983039,1048575,2097151,4194303,8388607,16777215,
%U A089226 33554431,67108863,134217727,268435455,536870911,1073741823,3221225471
%N A089226 Smallest composite number with exactly n 1's in binary representation.
%H A089226 Robert Israel, <a href="/A089226/b089226.txt">Table of n, a(n) for n = 1..3318</a>
%F A089226 A000120(a(n)) = n; A023416(a(n)) <= 1 for n>1. - _Ray Chandler_, Feb 15 2004
%F A089226 a(n) = A000225(n) unless n is in A000043. - _Robert Israel_, Jun 20 2019
%p A089226 f:= proc(n) local i,t;
%p A089226   for i from n to 0 by -1 do
%p A089226     t:= 2^(n+1) - 2^i - 1;
%p A089226     if not isprime(t) then return t fi
%p A089226   od
%p A089226 end proc:
%p A089226 f(1):= 4:
%p A089226 map(f, [$1..100]); # _Robert Israel_, Jun 20 2019
%t A089226 a[n_] := Module[{i, t},
%t A089226   For[i = n, i >= 0, i--,
%t A089226      t = 2^(n+1) - 2^i - 1;
%t A089226      If[!PrimeQ[t], Return [t]]]];
%t A089226 a[1] = 4;
%t A089226 Array[a, 100] (* _Jean-François Alcover_, Dec 16 2021, after _Robert Israel_ *)
%Y A089226 Cf. A000043, A000120, A000225, A023416, A061712.
%K A089226 nonn,base
%O A089226 1,1
%A A089226 _Reinhard Zumkeller_, Dec 10 2003
%E A089226 More terms from _Ray Chandler_, Feb 15 2004