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.

Showing 1-3 of 3 results.

A004050 Numbers of the form 2^j + 3^k, for j and k >= 0.

Original entry on oeis.org

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, 85, 89, 91, 97, 113, 129, 131, 137, 145, 155, 209, 244, 245, 247, 251, 257, 259, 265, 275, 283, 307, 337, 371, 499, 513, 515, 521, 539, 593, 730, 731, 733, 737, 745, 755
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A226806-A226832 (cases to 8^j + 9^k).
Cf. A004051 (primes), A000079, A000243.

Programs

  • Haskell
    import Data.Set (singleton, deleteFindMin, insert)
    a004050 n = a004050_list !! (n-1)
    a004050_list = f 1 $ singleton (2, 1, 1) where
       f x s = if y /= x then y : f y s'' else f x s''
               where s'' = insert (u * 2 + v, u * 2, v) $
                           insert (u + 3 * v, u, 3 * v) s'
                     ((y, u, v), s') = deleteFindMin s
    -- Reinhard Zumkeller, May 20 2015
    
  • Maple
    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
  • Mathematica
    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 *)
  • PARI
    ispow2(n)=n>>valuation(N,2)==1
    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
    
  • Python
    def aupto(lim):
        s, pow3 = set(), 1
        while pow3 < lim:
            for j in range((lim-pow3).bit_length()):
                s.add(2**j + pow3)
            pow3 *= 3
        return sorted(set(s))
    print(aupto(756)) # Michael S. Branicky, Jul 29 2021

Formula

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

Extensions

More terms from Sascha Kurz, Jan 02 2003

A141747 a(n) is the number of nonnegative integer pairs i,j such that n = 2^i + 3^j.

Original entry on oeis.org

0, 1, 1, 1, 2, 0, 1, 0, 1, 1, 2, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Clark Kimberling, Jul 01 2008

Keywords

Examples

			a(5) = 2, using (i,j) = (1,1) and (2,0).
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local j,t,s;
      t:= 0;
      for j from 0 to floor(log[3](n)) do
        s:= n - 3^j;
        if s = 2^padic:-ordp(s,2) then t:= t+1 fi
      od;
      t
    end proc:
    map(f, [$1..200]); # Robert Israel, Jun 08 2020

Formula

G.f.: ( Sum_{i>=0} x^(2^i) ) * ( Sum_{j>=0} x^(3^j) ). - Ilya Gutkovskiy, Feb 10 2022

A141748 a(n) = n-th nonnegative integer k such that there is a unique nonnegative integer pair (i,j) for which n = 2^i + 3^j.

Original entry on oeis.org

2, 3, 4, 7, 9, 10, 13, 19, 25, 28, 29, 31, 33, 41, 43, 59, 65, 67, 73, 82, 83, 85, 89, 91, 97, 113, 129, 131, 137, 145, 155, 209, 244, 245, 247, 251, 257, 265, 275, 283, 307, 337, 371, 499, 513, 515, 521, 539, 593, 730, 731, 733, 737, 745, 755, 761, 793, 857, 985
Offset: 1

Views

Author

Clark Kimberling, Jul 01 2008

Keywords

Comments

Locations of 1's in A141747.

Crossrefs

Showing 1-3 of 3 results.