A038465 Sums of 3 distinct powers of 3.
13, 31, 37, 39, 85, 91, 93, 109, 111, 117, 247, 253, 255, 271, 273, 279, 325, 327, 333, 351, 733, 739, 741, 757, 759, 765, 811, 813, 819, 837, 973, 975, 981, 999, 1053, 2191, 2197, 2199, 2215, 2217, 2223, 2269, 2271, 2277, 2295, 2431, 2433, 2439, 2457, 2511, 2917
Offset: 1
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
Total/@Subsets[3^Range[0,10],{3}]//Union (* Harvey P. Dale, Jul 10 2017 *)
-
Python
from math import comb, isqrt from sympy import integer_nthroot def A038465(n): return 3**((r:=n-1-comb((m:=integer_nthroot(6*n,3)[0])+(t:=(n>comb(m+2,3)))+1,3))-comb((k:=isqrt(b:=r+1<<1))+(b>k*(k+1)),2))+3**((a:=isqrt(s:=n-comb(m-(t^1)+2,3)<<1))+((s<<2)>(a<<2)*(a+1)+1))+3**(m+t+1) # Chai Wah Wu, Apr 04 2025
Extensions
Offset corrected by Amiram Eldar, Jul 13 2022