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.
%I A055235 #42 Aug 28 2025 14:56:36 %S A055235 2,4,6,10,12,18,28,30,36,54,82,84,90,108,162,244,246,252,270,324,486, %T A055235 730,732,738,756,810,972,1458,2188,2190,2196,2214,2268,2430,2916,4374, %U A055235 6562,6564,6570,6588,6642,6804,7290,8748,13122,19684,19686,19692,19710 %N A055235 Sums of two powers of 3. %H A055235 T. D. Noe, <a href="/A055235/b055235.txt">Rows n = 0..100 of triangle, flattened</a> %F A055235 a(n+1) = 3^(n-trinv(n)*(trinv(n)+1)/2)+3^trinv(n), where trinv(n) = floor((sqrt(1+8*n)-1)/2) = A003056(n) and n-trinv(n)*(trinv(n)+1)/2 = A002262(n). [corrected by _M. F. Hasler_, Oct 08 2011] %F A055235 Regarded as a triangle, T(n, k) = 3^n + 3^k, because 3^n + 3^n < 3^(n+1) + 3^0 for all n > 0. %t A055235 mx = 10; Sort[Flatten[Table[3^x + 3^y, {y, 0, mx}, {x, 0, y}]]] (* _Vladimir Joseph Stephan Orlovsky_, Apr 20 2011 *) %t A055235 f[n_] := Block[{t = Floor[(Sqrt[1 + 8 (n - 1)] - 1)/2]}, 3^(n - 1 - t*(t + 1)/2) + 3^t]; Array[f, 49] (* _Robert G. Wilson v_, Oct 08 2011 *) %t A055235 Total/@Tuples[3^Range[0,10],2]//Union (* _Harvey P. Dale_, Aug 28 2025 *) %o A055235 (PARI) for( n=0,5, for(k=0,n, print1(3^n+3^k","))) %o A055235 (PARI) A055235(n)={ my( t=(sqrtint(8*n-7)-1)\2); 3^t+3^(n-1-t*(t+1)/2) } \\ _M. F. Hasler_, Oct 08 2011 %o A055235 (Python) %o A055235 from math import isqrt %o A055235 def A055235(n): return 3**(a:=(k:=isqrt(m:=n<<1))+(m>k*(k+1))-1)+3**(n-1-(a*(a+1)>>1)) # _Chai Wah Wu_, Apr 08 2025 %Y A055235 Cf. A002262, A003056, A052216. %Y A055235 Partial sums of A135293. %K A055235 easy,nonn,tabl,changed %O A055235 0,1 %A A055235 _Henry Bottomley_, Jun 22 2000