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 A004050 #53 Oct 28 2022 07:15:48 %S A004050 2,3,4,5,7,9,10,11,13,17,19,25,28,29,31,33,35,41,43,59,65,67,73,82,83, %T A004050 85,89,91,97,113,129,131,137,145,155,209,244,245,247,251,257,259,265, %U A004050 275,283,307,337,371,499,513,515,521,539,593,730,731,733,737,745,755 %N A004050 Numbers of the form 2^j + 3^k, for j and k >= 0. %H A004050 Donovan Johnson, <a href="/A004050/b004050.txt">Table of n, a(n) for n = 1..10000</a> %H A004050 Douglas Edward Iannucci, <a href="https://arxiv.org/abs/1907.03347">On duplicate representations as 2^x+3^y for nonnegative integers x and y</a>, arXiv:1907.03347 [math.NT], 2019. %F A004050 There are log^2 x/(log 2 log 3) + O(log x) terms up to x. Bounds on the error term can be made explicit. - _Charles R Greathouse IV_, Oct 28 2022 %p A004050 lincom:=proc(a,b,n) local i,j,s,m; s:={}; for i from 0 to n do for j from 0 to n do m:=a^i+b^j; if m<=n then s:={op(s),m} fi od; od; lprint(sort([op(s)])); end: lincom(2,3,760); # _Zerinvary Lajos_, Feb 24 2007 %t A004050 mx = 760; s = Union@ Flatten@ Table[2^i + 3^j, {i, 0, Log[2, mx]}, {j, 0, Log[3, mx - 2^i]}] (* _Robert G. Wilson v_, Sep 19 2012 *) %o A004050 (Haskell) %o A004050 import Data.Set (singleton, deleteFindMin, insert) %o A004050 a004050 n = a004050_list !! (n-1) %o A004050 a004050_list = f 1 $ singleton (2, 1, 1) where %o A004050 f x s = if y /= x then y : f y s'' else f x s'' %o A004050 where s'' = insert (u * 2 + v, u * 2, v) $ %o A004050 insert (u + 3 * v, u, 3 * v) s' %o A004050 ((y, u, v), s') = deleteFindMin s %o A004050 -- _Reinhard Zumkeller_, May 20 2015 %o A004050 (PARI) ispow2(n)=n>>valuation(N,2)==1 %o A004050 is(n)=my(k); if(n%2, if(n<3, return(0)); for(k=0,logint(n-2,3), if(ispow2(n-3^k), return(1))); 0, ispower(n-1,,&k); k==3 || n==2 || n==4) \\ _Charles R Greathouse IV_, Aug 29 2016 %o A004050 (Python) %o A004050 def aupto(lim): %o A004050 s, pow3 = set(), 1 %o A004050 while pow3 < lim: %o A004050 for j in range((lim-pow3).bit_length()): %o A004050 s.add(2**j + pow3) %o A004050 pow3 *= 3 %o A004050 return sorted(set(s)) %o A004050 print(aupto(756)) # _Michael S. Branicky_, Jul 29 2021 %Y A004050 Cf. A085634, A219835. %Y A004050 Cf. A226806-A226832 (cases to 8^j + 9^k). %Y A004050 Cf. A004051 (primes), A000079, A000243. %K A004050 nonn %O A004050 1,1 %A A004050 _N. J. A. Sloane_ %E A004050 More terms from _Sascha Kurz_, Jan 02 2003