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.

A072823 Numbers that are not the sum of two powers of 2.

This page as a plain text file.
%I A072823 #38 Oct 30 2024 13:30:20
%S A072823 1,7,11,13,14,15,19,21,22,23,25,26,27,28,29,30,31,35,37,38,39,41,42,
%T A072823 43,44,45,46,47,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,67,69,70,
%U A072823 71,73,74,75,76,77,78,79,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97
%N A072823 Numbers that are not the sum of two powers of 2.
%C A072823 1 and integers with three or more 1-bits in their binary expansion. - _Vladimir Baltic_, Jul 23 2002
%C A072823 Appears to be the numbers k >1 for which there exist an x and y (x>y) such that x OR y = k, x+y != k, and x<k. - _Gary Detlefs_, Jun 02 2014
%H A072823 Reinhard Zumkeller, <a href="/A072823/b072823.txt">Table of n, a(n) for n = 1..10000</a>
%F A072823 A073267(a(n)) = 0. [_Reinhard Zumkeller_, Mar 07 2012]
%p A072823 f:= x -> convert(convert(x,base,2),`+`)>2:
%p A072823 {1} union select(f, {$2..1000}); # _Robert Israel_, Jun 08 2014
%t A072823 Join[{1}, Select[Range[100], DigitCount[#, 2, 1] >= 3&]] (* _Jean-François Alcover_, Mar 08 2019 *)
%o A072823 (Haskell)
%o A072823 a072823 n = a072823_list !! (n-1)
%o A072823 a072823_list = tail $ elemIndices 0 a073267_list
%o A072823 -- _Reinhard Zumkeller_, Mar 07 2012
%o A072823 (Python)
%o A072823 from math import comb
%o A072823 from itertools import count, islice
%o A072823 def A072823(n):
%o A072823     def f(x):
%o A072823         s = bin(x)[2:]
%o A072823         c = n-1+(l:=len(s))+comb(l-1,2)
%o A072823         try:
%o A072823             c += l-1-s[1:].index('1')
%o A072823         except:
%o A072823             pass
%o A072823         return c
%o A072823     m, k = n-1, f(n-1)
%o A072823     while m != k: m, k = k, f(k)
%o A072823     return m
%o A072823 def A072823_gen(): # generator of terms
%o A072823     return filter(lambda n:n==1 or n.bit_count()>2,count(1))
%o A072823 A072823_list = list(islice(A072823_gen(),50)) # _Chai Wah Wu_, Oct 30 2024
%Y A072823 Cf. A000079, A048645, A073267.
%K A072823 nonn
%O A072823 1,2
%A A072823 _Jeremy Gardiner_, Jul 21 2002