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-10 of 34 results. Next

A219841 Positions of numbers 2^n + 3^n (n >= 0) in A004050.

Original entry on oeis.org

1, 4, 9, 17, 29, 44, 62, 86, 108, 139, 166, 204, 245, 282, 331, 371, 427, 472, 535, 602, 656, 730, 788, 869, 953, 1021, 1113, 1184, 1283, 1359, 1465, 1575, 1660, 1777, 1866, 1990, 2118, 2216, 2351, 2453, 2595, 2702, 2851, 3004, 3120, 3280, 3400, 3567, 3738
Offset: 0

Views

Author

Zak Seidov, Nov 29 2012

Keywords

Examples

			a(0) = 1 because 2^0 + 3^0 = 1 = A004050(1),
a(1) = 4 because 2^1 + 3^1 = 5 = A004050(4).
		

Crossrefs

Cf. A004050.

A029837 Binary order of n: log_2(n) rounded up to next integer.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
Offset: 1

Views

Author

Keywords

Comments

Or, ceiling(log_2(n)).
Worst-case cost of binary search.
Equal to number of binary digits in n unless n is a power of 2 when it is one less.
Thus a(n) gives the length of the binary representation of n - 1 (n >= 2), which is also A070939(n - 1).
Let x(0) = n > 1 and x(k + 1) = x(k) - floor(x(k)/2), then a(n) is the smallest integer such that x(a(n)) = 1. - Benoit Cloitre, Aug 29 2002
Also number of division steps when going from n to 1 by process of adding 1 if odd, or dividing by 2 if even. - Cino Hilliard, Mar 25 2003
Number of ways to write n as (x + 2^y), x >= 0. Number of ways to write n + 1 as 2^x + 3^y (cf. A004050). - Benoit Cloitre, Mar 29 2003
The minimum number of cuts for dividing an object into n (possibly unequal) pieces. - Karl Ove Hufthammer (karl(AT)huftis.org), Mar 29 2010
Partial sums of A209229; number of powers of 2 not greater than n. - Reinhard Zumkeller, Mar 07 2012

Examples

			a(1) = 0, since log_2(1) = 0.
a(2) = 1, since log_2(2) = 1.
a(3) = 2, since log_2(3) = 1.58...
a(n) = 7 for n = 65, 66, ..., 127, 128.
G.f. = x^2 + 2*x^3 + 2*x^4 + 3*x^5 + 3*x^6 + 3*x^7 + 3*x^8 + 4*x^9 + ... - _Michael Somos_, Jun 02 2019
		

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, 1989, p. 70.
  • G. J. E. Rawlins, Compared to What? An Introduction to the Analysis of Algorithms, W. H. Freeman, 1992; see pp. 108, 118.

Crossrefs

Partial sums of A036987.
Used for several definitions: A029827, A036378-A036390. Partial sums: A001855.

Programs

  • Haskell
    a029837 n = a029837_list !! (n-1)
    a029837_list = scanl1 (+) a209229_list
    -- Reinhard Zumkeller, Mar 07 2012
    (Common Lisp) (defun A029837 (n) (integer-length (1- n))) ; James Spahlinger, Oct 15 2012
    
  • Magma
    [Ceiling(Log(2, n)): n in [1..100]]; // Vincenzo Librandi, Jun 14 2019
    
  • Maple
    a:= n-> (p-> p+`if`(2^pAlois P. Heinz, Mar 18 2013
  • Mathematica
    a[n_] := Ceiling[Log[2, n]]; Array[a, 105] (* Robert G. Wilson v, Dec 09 2005 *)
    Table[IntegerLength[n - 1, 2], {n, 1, 105}] (* Peter Luschny, Dec 02 2017 *)
    a[n_] := If[n < 1, 0, BitLength[n - 1]]; (* Michael Somos, Jul 10 2018 *)
    Join[{0}, IntegerLength[Range[130], 2]] (* Vincenzo Librandi, Jun 14 2019 *)
  • PARI
    {a(n) = if( n<1, 0, ceil(log(n) / log(2)))};
    
  • PARI
    /* Set p = 1, then: */
    xpcount(n,p) = for(x=1, n, p1 = x; ct=0; while(p1>1, if(p1%2==0,p1/=2; ct++,p1 = p1*p+1)); print1(ct, ", "))
    
  • PARI
    {a(n) = if( n<2, 0, exponent(n-1)+1)}; /* Michael Somos, Jul 10 2018 */
    
  • Python
    def A029837(n):
        s = bin(n)[2:]
        return len(s) - (1 if s.count('1') == 1 else 0) # Chai Wah Wu, Jul 09 2020
    
  • Python
    def A029837(n): return (n-1).bit_length() # Chai Wah Wu, Jun 30 2022
  • Scala
    (1 to 80).map(n => Math.ceil(Math.log(n)/Math.log(2)).toInt) // Alonso del Arte, Feb 19 2020
    

Formula

a(n) = ceiling(log_2(n)).
a(1) = 0; for n > 1, a(2n) = a(n) + 1, a(2n + 1) = a(n) + 1. Alternatively, a(1) = 0; for n > 1, a(n) = a(ceiling(n/2)) + 1. [corrected by Ilya Gutkovskiy, Mar 21 2020]
a(n) = k such that n^(1/k - 1) > 2 > n^(1/k), or the least value of k for which floor n^(1/k) = 1. a(n) = k for all n such that 2^(k - 1) < n < 2^k. - Amarnath Murthy, May 06 2001
G.f.: x/(1 - x) * Sum_{k >= 0} x^2^k. - Ralf Stephan, Apr 13 2002
A062383(n-1) = 2^a(n). - Johannes W. Meijer, Jul 06 2009
a(n+1) = -Sum_{k = 1..n} mu(2*k)*floor(n/k). - Benoit Cloitre, Oct 21 2009
a(n+1) = A113473(n). - Michael Somos, Jun 02 2019

Extensions

Additional comments from Daniele Parisse
More terms from Michael Somos, Aug 02 2002

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

Original entry on oeis.org

2, 3, 5, 6, 8, 9, 12, 17, 18, 20, 24, 32, 33, 36, 48, 65, 66, 68, 72, 80, 96, 128, 129, 132, 144, 192, 257, 258, 260, 264, 272, 288, 320, 384, 512, 513, 516, 528, 576, 768, 1025, 1026, 1028, 1032, 1040, 1056, 1088, 1152, 1280, 1536, 2048, 2049, 2052, 2064
Offset: 1

Views

Author

T. D. Noe, Jun 19 2013

Keywords

Comments

Conjecture: Any integer n > 1 not equal to 4 can be written as a sum of distinct terms of the current sequence with no summand dividing another. - Zhi-Wei Sun, May 01 2023

Crossrefs

Cf. A004050 (2^j + 3^k), A226807-A226832 (cases to 8^j + 9^k).

Programs

  • Mathematica
    a = 2; b = 4; mx = 3000; Union[Flatten[Table[a^n + b^m, {m, 0, Log[b, mx]}, {n, 0, Log[a, mx - b^m]}]]]
  • PARI
    ispow2(n)=n>>valuation(n,2)==1
    is(n)=my(h=hammingweight(n)); if(h>2, 0, h==2, valuation(n,2)%2==0 || logint(n,2)%2==0, h==1 && valuation(n,2)%2) \\ Charles R Greathouse IV, Aug 29 2016

A226832 Numbers of the form 8^j + 9^k, for j and k >= 0.

Original entry on oeis.org

2, 9, 10, 17, 65, 73, 82, 89, 145, 513, 521, 593, 730, 737, 793, 1241, 4097, 4105, 4177, 4825, 6562, 6569, 6625, 7073, 10657, 32769, 32777, 32849, 33497, 39329, 59050, 59057, 59113, 59561, 63145, 91817, 262145, 262153, 262225, 262873, 268705, 321193, 531442
Offset: 1

Views

Author

T. D. Noe, Jun 19 2013

Keywords

Crossrefs

Cf. A004050 (2^j + 3^k), A226806-A226831 (cases to 7^j + 9^k).

Programs

  • Mathematica
    a = 8; b = 9; mx = 600000; Union[Flatten[Table[a^n + b^m, {m, 0, Log[b, mx]}, {n, 0, Log[a, mx - b^m]}]]]
  • PARI
    ispowof(n,k)=k^valuation(n,k)==n
    is(n)=if(n%8 != 1, return(ispowof(n-1,9))); for(k=0,logint(n-1,9), if(ispowof(n-9^k,8), return(1))); 0 \\ Charles R Greathouse IV, Aug 29 2016

A004051 Primes of the form 2^a + 3^b.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43, 59, 67, 73, 83, 89, 97, 113, 131, 137, 251, 257, 283, 307, 337, 499, 521, 593, 733, 761, 857, 1033, 1051, 1753, 2129, 2203, 2251, 2699, 2777, 4099, 4177, 4339, 6563, 6569, 6577, 6689, 8219, 8273, 8609, 10657, 14753
Offset: 1

Views

Author

Keywords

Comments

Are a(3)=5, a(5)=11 and a(7)=17 the only cases with two ways of representation: {5=2^2+3^0=2^1+3^1, 11=2^3+3^1=2^1+3^2, 17=2^4+3^0=2^3+3^2}? - Zak Seidov, Feb 24 2015

Crossrefs

Cf. A010051, subsequence of A004050.

Programs

  • Haskell
    a004051 n = a004051_list !! (n-1)
    a004051_list = filter ((== 1) . a010051'') a004050_list
    -- Reinhard Zumkeller, May 20 2015
  • MATLAB
    n = 0; for a = 0:30 p1 = 2^a; for b = 0:19; p2 = 3^b; p3 = p1 + p2; if isprime(p3) n = n + 1; c(n) = p3; end; end; end; c = sort(c); k = size(c, 2); for i = 2:k if c(i-1) == c(i) c(i-1) = 0 end; end; c = sort(c); c = sym(c) % Lei Zhou, Jan 26 2005
    
  • Mathematica
    nMax = 15000; Union[Select[2^First[#] + 3^Last[#] & /@ Tuples[{Range[0, Log[2, nMax]], Range[0, Log[3, nMax]]}], # <= nMax && PrimeQ[#] &]]  (* Harvey P. Dale, Mar 13 2011 *)

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

Original entry on oeis.org

2, 4, 5, 7, 10, 13, 17, 19, 25, 28, 31, 43, 65, 67, 73, 82, 85, 91, 97, 145, 244, 247, 257, 259, 265, 283, 307, 337, 499, 730, 733, 745, 793, 985, 1025, 1027, 1033, 1051, 1105, 1267, 1753, 2188, 2191, 2203, 2251, 2443, 3211, 4097, 4099, 4105, 4123, 4177, 4339
Offset: 1

Views

Author

T. D. Noe, Jun 19 2013

Keywords

Comments

Conjecture: Each integer n > 8 can be written as a sum of finitely many numbers of the form 3^a + 4^b (a,b >= 0) with no one dividing another. This has been verified for all n <= 1500. - Zhi-Wei Sun, Apr 18 2023

Crossrefs

Cf. A004050 (2^j + 3^k), A226806-A226832 (cases to 8^j + 9^k).

Programs

  • Mathematica
    a = 3; b = 4; mx = 5000; Union[Flatten[Table[a^n + b^m, {m, 0, Log[b, mx]}, {n, 0, Log[a, mx - b^m]}]]]

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

Original entry on oeis.org

2, 4, 6, 8, 10, 14, 26, 28, 32, 34, 52, 82, 86, 106, 126, 128, 134, 152, 206, 244, 248, 268, 368, 626, 628, 634, 652, 706, 730, 734, 754, 854, 868, 1354, 2188, 2192, 2212, 2312, 2812, 3126, 3128, 3134, 3152, 3206, 3368, 3854, 5312, 6562, 6566, 6586, 6686, 7186
Offset: 1

Views

Author

T. D. Noe, Jun 19 2013

Keywords

Crossrefs

Cf. A004050 (2^j + 3^k), A226806-A226832 (cases to 8^j + 9^k).
Cf. A193769, A226790 (a(n)/2 with/without repetition).

Programs

  • Mathematica
    a = 3; b = 5; mx = 8000; Union[Flatten[Table[a^n + b^m, {m, 0, Log[b, mx]}, {n, 0, Log[a, mx - b^m]}]]]

A226810 Numbers of the form 4^j + 5^k, for j and k >= 0.

Original entry on oeis.org

2, 5, 6, 9, 17, 21, 26, 29, 41, 65, 69, 89, 126, 129, 141, 189, 257, 261, 281, 381, 626, 629, 641, 689, 881, 1025, 1029, 1049, 1149, 1649, 3126, 3129, 3141, 3189, 3381, 4097, 4101, 4121, 4149, 4221, 4721, 7221, 15626, 15629, 15641, 15689, 15881, 16385, 16389
Offset: 1

Views

Author

T. D. Noe, Jun 19 2013

Keywords

Crossrefs

Cf. A004050 (2^j + 3^k), A226806-A226832 (cases to 8^j + 9^k).

Programs

  • Mathematica
    a = 4; b = 5; mx = 20000; Union[Flatten[Table[a^n + b^m, {m, 0, Log[b, mx]}, {n, 0, Log[a, mx - b^m]}]]]

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

Original entry on oeis.org

2, 4, 8, 10, 16, 28, 34, 50, 52, 58, 76, 82, 88, 130, 244, 250, 292, 344, 346, 352, 370, 424, 586, 730, 736, 778, 1072, 2188, 2194, 2236, 2402, 2404, 2410, 2428, 2482, 2530, 2644, 3130, 4588, 6562, 6568, 6610, 6904, 8962, 16808, 16810, 16816, 16834, 16888
Offset: 1

Views

Author

T. D. Noe, Jun 19 2013

Keywords

Crossrefs

Cf. A004050 (2^j + 3^k), A226806-A226832 (cases to 8^j + 9^k).
Cf. A226791 ((3^j + 7^k)/2).

Programs

  • Mathematica
    a = 3; b = 7; mx = 20000; Union[Flatten[Table[a^n + b^m, {m, 0, Log[b, mx]}, {n, 0, Log[a, mx - b^m]}]]]

A226831 Numbers of the form 7^j + 9^k, for j and k >= 0.

Original entry on oeis.org

2, 8, 10, 16, 50, 58, 82, 88, 130, 344, 352, 424, 730, 736, 778, 1072, 2402, 2410, 2482, 3130, 6562, 6568, 6610, 6904, 8962, 16808, 16816, 16888, 17536, 23368, 59050, 59056, 59098, 59392, 61450, 75856, 117650, 117658, 117730, 118378, 124210, 176698, 531442
Offset: 1

Views

Author

T. D. Noe, Jun 19 2013

Keywords

Crossrefs

Cf. A004050 (2^j + 3^k), A226806-A226832 (cases to 8^j + 9^k).
Cf. A226795 ((7^j + 9^k)/2).

Programs

  • Mathematica
    a = 7; b = 9; mx = 600000; Union[Flatten[Table[a^n + b^m, {m, 0, Log[b, mx]}, {n, 0, Log[a, mx - b^m]}]]]
  • PARI
    list(lim)=my(v=List(),J,K); for(j=0,logint((lim\=1)-1,7), J=7^j; K=1; while(J+K<=lim, listput(v,J+K); K*=9)); Set(v) \\ Charles R Greathouse IV, Feb 18 2021
Showing 1-10 of 34 results. Next