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.

A188915 Union of squares and powers of 2.

This page as a plain text file.
%I A188915 #27 Apr 13 2025 03:15:14
%S A188915 0,1,2,4,8,9,16,25,32,36,49,64,81,100,121,128,144,169,196,225,256,289,
%T A188915 324,361,400,441,484,512,529,576,625,676,729,784,841,900,961,1024,
%U A188915 1089,1156,1225,1296,1369,1444,1521,1600,1681,1764,1849,1936,2025,2048,2116,2209,2304,2401,2500,2601,2704,2809,2916
%N A188915 Union of squares and powers of 2.
%C A188915 A188916 and A188917 give positions where squares and powers of 2 occur:
%C A188915 n^2: a(A188916(n)) = A000290(n);
%C A188915 2^n: a(A188917(n)) = A000079(n);
%C A188915 4^n: a(A006127(n)) = A000302(n), A006127 is the intersection of A188916 and A188917.
%H A188915 Reinhard Zumkeller, <a href="/A188915/b188915.txt">Table of n, a(n) for n = 0..10000</a>
%F A188915 A010052(a(n)) + A209229(a(n)) > 0. - _Reinhard Zumkeller_, May 19 2015
%F A188915 Sum_{n>=1} 1/a(n) = Pi^2/6 + 2/3. - _Amiram Eldar_, Apr 13 2025
%t A188915 seq[lim_] := Union[2^Range[1, Floor[Log2[lim]], 2], Range[0, Floor[Sqrt[lim]]]^2]; seq[3000] (* _Amiram Eldar_, Apr 13 2025 *)
%o A188915 (Haskell)
%o A188915 import Data.List.Ordered (union)
%o A188915 a188915 n = a188915_list !! n
%o A188915 a188915_list = union a000290_list a000079_list
%o A188915 -- _Reinhard Zumkeller_, May 19 2015, Apr 14 2011
%o A188915 (Python)
%o A188915 from math import isqrt
%o A188915 def A188915(n):
%o A188915     def bisection(f,kmin=0,kmax=1):
%o A188915         while f(kmax) > kmax: kmax <<= 1
%o A188915         while kmax-kmin > 1:
%o A188915             kmid = kmax+kmin>>1
%o A188915             if f(kmid) <= kmid:
%o A188915                 kmax = kmid
%o A188915             else:
%o A188915                 kmin = kmid
%o A188915         return kmax
%o A188915     def f(x): return n+x-isqrt(x)-((m:=x.bit_length()-1)>>1)-(m&1)
%o A188915     return bisection(f,n-1,n**2) # _Chai Wah Wu_, Sep 19 2024
%Y A188915 Union of A000290 and A000079.
%Y A188915 Disjoint union of A000290 and A004171.
%Y A188915 Cf. A000302, A010052, A209229, A006127, A188916, A188917.
%K A188915 nonn
%O A188915 0,3
%A A188915 _Reinhard Zumkeller_, Apr 14 2011