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.

A038470 Sums of 2 distinct powers of 4.

This page as a plain text file.
%I A038470 #16 Apr 05 2025 15:13:46
%S A038470 5,17,20,65,68,80,257,260,272,320,1025,1028,1040,1088,1280,4097,4100,
%T A038470 4112,4160,4352,5120,16385,16388,16400,16448,16640,17408,20480,65537,
%U A038470 65540,65552,65600,65792,66560,69632,81920,262145,262148,262160,262208,262400,263168
%N A038470 Sums of 2 distinct powers of 4.
%H A038470 Amiram Eldar, <a href="/A038470/b038470.txt">Table of n, a(n) for n = 1..10000</a>
%t A038470 Sort[Plus @@@ Subsets[4^Range[0, 9], {2}]] (* _Amiram Eldar_, Jul 13 2022 *)
%o A038470 (Python)
%o A038470 def aupto(limit):
%o A038470   p = [4**i for i in range(limit//4+1) if 4**i < limit]
%o A038470   p2 = set(a+b for i, a in enumerate(p) for b in p[i+1:] if a+b <= limit)
%o A038470   return sorted(p2)
%o A038470 print(aupto(265000)) # _Michael S. Branicky_, May 17 2021
%o A038470 (Python)
%o A038470 from math import isqrt
%o A038470 def A038470(n): return (1<<(m:=isqrt(n<<3)+1&-2))+(1<<(n-1<<1)-((k:=m>>1)*(k-1))) # _Chai Wah Wu_, Apr 05 2025
%Y A038470 Base-4 interpretation of A038444.
%Y A038470 Cf. A000302, A038471, A038472, A038473.
%K A038470 nonn,easy
%O A038470 1,1
%A A038470 _Olivier Gérard_
%E A038470 Offset corrected by _Amiram Eldar_, Jul 13 2022