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.

A309758 Numbers that are sums of consecutive powers of 3.

This page as a plain text file.
%I A309758 #14 Apr 04 2025 14:37:06
%S A309758 1,3,4,9,12,13,27,36,39,40,81,108,117,120,121,243,324,351,360,363,364,
%T A309758 729,972,1053,1080,1089,1092,1093,2187,2916,3159,3240,3267,3276,3279,
%U A309758 3280,6561,8748,9477,9720,9801,9828,9837,9840,9841,19683,26244,28431
%N A309758 Numbers that are sums of consecutive powers of 3.
%C A309758 Numbers of the form (3^i - 3^j)/2 with i > j.
%H A309758 Robert Israel, <a href="/A309758/b309758.txt">Table of n, a(n) for n = 1..10000</a>
%e A309758 1080 = 3^3 + 3^4 + 3^5 + 3^6, so 1080 is in the sequence.
%e A309758 +------+--------+
%e A309758 | a(n) | base 3*|
%e A309758 +------+--------+
%e A309758 |   1  |     1  |
%e A309758 |   3  |    10  |
%e A309758 |   4  |    11  |
%e A309758 |   9  |   100  |
%e A309758 |  12  |   110  |
%e A309758 |  13  |   111  |
%e A309758 |  27  |  1000  |
%e A309758 |  36  |  1100  |
%e A309758 |  39  |  1110  |
%e A309758 |  40  |  1111  |
%e A309758 +------+--------+
%e A309758 * - a(n) written in base 3.
%p A309758 [seq(seq((3^i-3^j)/2,j=i-1..0,-1),i=1..20)]; # _Robert Israel_, Aug 19 2019
%o A309758 (Python)
%o A309758 from math import isqrt
%o A309758 def A309758(n): return 3**(m:=isqrt(n<<3)+1>>1)-3**(m*(m+1)-(n<<1)>>1)>>1 # _Chai Wah Wu_, Apr 04 2025
%Y A309758 Cf. A000244, A005836, A023758, A038464, A309759, A309761.
%K A309758 nonn
%O A309758 1,2
%A A309758 _Ilya Gutkovskiy_, Aug 15 2019