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 77 results. Next

A151774 Characteristic function of numbers with binary weight 2 (A018900).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jun 23 2009

Keywords

Comments

a(A018900(n)) = 1; a(A161989(n)) = 0. - Reinhard Zumkeller, Jun 24 2009

Crossrefs

Programs

Formula

Let Theta = Sum_{k >= 0} x^(2^k). G.f. is (x + Theta^2 - Theta)/2 (cf. A151758).

A274048 a(n) = A116640(A018900(n)) = A116623(A059893(A018900(n))).

Original entry on oeis.org

19, 23, 29, 31, 37, 49, 47, 53, 65, 89, 79, 85, 97, 121, 169, 143, 149, 161, 185, 233, 329, 271, 277, 289, 313, 361, 457, 649, 527, 533, 545, 569, 617, 713, 905, 1289, 1039, 1045, 1057, 1081, 1129, 1225, 1417, 1801
Offset: 1

Views

Author

Joe Slater, Jun 07 2016

Keywords

Comments

A subset of A116640 containing all terms A116640(m) such that m has binary weight of 2. This sequence is related to the Collatz and Terras trajectories; specifically those trajectories that include three odd numbers besides 1.

Examples

			The first three terms of A018900 are 3,5,6. Taking these terms from A116640 gives 19,23,29, which are the first three terms of this sequence. The sequence is generated from the regular triangle
1;
1,2;
1,2,3;
etc., so the first three terms are
2^(1+1) + 3*(3+2^1) = 19;
2^(2+1) + 3*(3+2^1) = 23;
2^(2+1) + 3*(3+2^2)= 29.
		

Crossrefs

Subsequence of A116640.
Cf. A116623.

Formula

a(n) = 2^(Row(n)+1) + 3*(3+2^Col(n)) where Row(n) = A002024(n) = the row position of n when the sequence is viewed as a regular triangle; and Col(n) = A002260(n) = the column position of n when the sequence is viewed as a regular triangle.

A357840 Numbers k in A018900 with arithmetic derivative k' (A003415) in A018900.

Original entry on oeis.org

6, 9, 20, 40, 65, 68, 96, 144, 192, 528, 576, 1028, 4097, 73728, 81920, 262148, 557056, 6291456, 9437184, 12582912, 201326592, 335544320, 2415919104, 1374389534720, 11258999068426240, 90071992547409920, 648518346341351424, 78398662313265594368, 116056878683004400771792896
Offset: 1

Views

Author

Marius A. Burtea, Oct 20 2022

Keywords

Comments

Numbers with Hamming weight 2 that have the arithmetic derivative with Hamming weight 2.
If p is in A019434 then m = 4*p is a term. Indeed p = 2^k + 1 and m' = 4*p + 4 = 4 (p + 1) = 4*(2^k + 2) = 8*(2^(k - 1) +1) = 2^(k + 2) + 2^3 and m, m' have only two of 1 in the expansion binary.
Numbers of the form m = 5*2^s, where s = (16^k - 1)/5, s >= 1, are terms. Indeed m = 4*2^s + 2^s = 2^(s + 2) + 2^s and m' = 2^s + 5*s*2^(s - 1) = 2^(s - 1)*(5*s + 2) = 2^(s - 1)*(16^k + 1) = 2^(4*k + s - 1) + 2^(s - 1), so m is a term.
Numbers of the form m = 3*2^s, where s = (4^k - 1)/3, s >= 1, are terms. Indeed m = 2*2^s + 2^s = 2^(s + 1) + 2^s and m' = 2^s + 3*s*2^(s - 1) = 2^(s - 1)*(3*s + 2) = 2^(s - 1)*(4^k + 1) = 2^(2*k + s - 1) + 2^(s - 1), so m is a term.

Examples

			6 = 110_2 = 2^2 + 2^1 and 6' = 5 = 101_2 = 2^2 + 2^0, so 6 is a term.
9 = 1001_2 = 2^3 + 2^0 and 9' = 6 = 110_2, so 9 is a term.
20 = 10100_2 = 2^4 + 2^2 and 20' = 24 = 11000_2 = 2^4 + 2^3, so 20 is a term.
		

Crossrefs

Programs

  • Magma
    f1:=func; f:=func; a:=[]; for n in [1..75] do sn:=[2^n+2^k: k in [0..n-1]]; for i in [1..#sn] do if f1(sn[i]) and f1(Floor(f(sn[i]))) then Append(~a,sn[i]); end if; end for; end for; a;
    
  • Mathematica
    d[0] = d[1] = 0; d[n_] := n*Plus @@ ((Last[#]/First[#]) & /@ FactorInteger[n]); Select[Union[Plus @@@ (2^Subsets[Range[0, 86], {2}])], Count[IntegerDigits[d[#], 2], 1] == 2 &] (* Amiram Eldar, Oct 21 2022 *)
  • PARI
    ish2(n) = hammingweight(n)==2; \\ A018900
    ad(n) = vecsum([n/f[1]*f[2]|f<-factor(n+!n)~]); \\ A003415
    isok(m) = ish2(m) && ish2(ad(m)); \\ Michel Marcus, Oct 23 2022

A000079 Powers of 2: a(n) = 2^n.

Original entry on oeis.org

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592
Offset: 0

Views

Author

Keywords

Comments

2^0 = 1 is the only odd power of 2.
Number of subsets of an n-set.
There are 2^(n-1) compositions (ordered partitions) of n (see for example Riordan). This is the unlabeled analog of the preferential labelings sequence A000670.
This is also the number of weakly unimodal permutations of 1..n + 1, that is, permutations with exactly one local maximum. E.g., a(4) = 16: 12345, 12354, 12453, 12543, 13452, 13542, 14532 and 15432 and their reversals. - Jon Perry, Jul 27 2003 [Proof: see next line! See also A087783.]
Proof: n must appear somewhere and there are 2^(n-1) possible choices for the subset that precedes it. These must appear in increasing order and the rest must follow n in decreasing order. QED. - N. J. A. Sloane, Oct 26 2003
a(n+1) is the smallest number that is not the sum of any number of (distinct) earlier terms.
Same as Pisot sequences E(1, 2), L(1, 2), P(1, 2), T(1, 2). See A008776 for definitions of Pisot sequences.
With initial 1 omitted, same as Pisot sequences E(2, 4), L(2, 4), P(2, 4), T(2, 4). - David W. Wilson
Not the sum of two or more consecutive numbers. - Lekraj Beedassy, May 14 2004
Least deficient or near-perfect numbers (i.e., n such that sigma(n) = A000203(n) = 2n - 1). - Lekraj Beedassy, Jun 03 2004. [Comment from Max Alekseyev, Jan 26 2005: All the powers of 2 are least deficient numbers but it is not known if there exists a least deficient number that is not a power of 2.]
Almost-perfect numbers referred to as least deficient or slightly defective (Singh 1997) numbers. Does "near-perfect numbers" refer to both almost-perfect numbers (sigma(n) = 2n - 1) and quasi-perfect numbers (sigma(n) = 2n + 1)? There are no known quasi-perfect or least abundant or slightly excessive (Singh 1997) numbers.
The sum of the numbers in the n-th row of Pascal's triangle; the sum of the coefficients of x in the expansion of (x+1)^n.
The Collatz conjecture (the hailstone sequence will eventually reach the number 1, regardless of which positive integer is chosen initially) may be restated as (the hailstone sequence will eventually reach a power of 2, regardless of which positive integer is chosen initially).
The only hailstone sequence which doesn't rebound (except "on the ground"). - Alexandre Wajnberg, Jan 29 2005
With p(n) as the number of integer partitions of n, p(i) is the number of parts of the i-th partition of n, d(i) is the number of different parts of the i-th partition of n, m(i,j) is the multiplicity of the j-th part of the i-th partition of n, one has: a(n) = Sum_{i = 1..p(n)} (p(i)! / (Product_{j=1..d(i)} m(i,j)!)). - Thomas Wieder, May 18 2005
The number of binary relations on an n-element set that are both symmetric and antisymmetric. Also the number of binary relations on an n-element set that are symmetric, antisymmetric and transitive.
The first differences are the sequence itself. - Alexandre Wajnberg and Eric Angelini, Sep 07 2005
a(n) is the largest number with shortest addition chain involving n additions. - David W. Wilson, Apr 23 2006
Beginning with a(1) = 0, numbers not equal to the sum of previous distinct natural numbers. - Giovanni Teofilatto, Aug 06 2006
For n >= 1, a(n) is equal to the number of functions f:{1, 2, ..., n} -> {1, 2} such that for a fixed x in {1, 2, ..., n} and a fixed y in {1, 2} we have f(x) != y. - Aleksandar M. Janjic and Milan Janjic, Mar 27 2007
Let P(A) be the power set of an n-element set A. Then a(n) is the number of pairs of elements {x,y} of P(A) for which x = y. - Ross La Haye, Jan 09 2008
a(n) is the number of permutations on [n+1] such that every initial segment is an interval of integers. Example: a(3) counts 1234, 2134, 2314, 2341, 3214, 3241, 3421, 4321. The map "p -> ascents of p" is a bijection from these permutations to subsets of [n]. An ascent of a permutation p is a position i such that p(i) < p(i+1). The permutations shown map to 123, 23, 13, 12, 3, 2, 1 and the empty set respectively. - David Callan, Jul 25 2008
2^(n-1) is the largest number having n divisors (in the sense of A077569); A005179(n) is the smallest. - T. D. Noe, Sep 02 2008
a(n) appears to match the number of divisors of the modified primorials (excluding 2, 3 and 5). Very limited range examined, PARI example shown. - Bill McEachen, Oct 29 2008
Successive k such that phi(k)/k = 1/2, where phi is Euler's totient function. - Artur Jasinski, Nov 07 2008
A classical transform consists (for general a(n)) in swapping a(2n) and a(2n+1); examples for Jacobsthal A001045 and successive differences: A092808, A094359, A140505. a(n) = A000079 leads to 2, 1, 8, 4, 32, 16, ... = A135520. - Paul Curtz, Jan 05 2009
This is also the (L)-sieve transform of {2, 4, 6, 8, ..., 2n, ...} = A005843. (See A152009 for the definition of the (L)-sieve transform.) - John W. Layman, Jan 23 2009
a(n) = a(n-1)-th even natural number (A005843) for n > 1. - Jaroslav Krizek, Apr 25 2009
For n >= 0, a(n) is the number of leaves in a complete binary tree of height n. For n > 0, a(n) is the number of nodes in an n-cube. - K.V.Iyer, May 04 2009
Permutations of n+1 elements where no element is more than one position right of its original place. For example, there are 4 such permutations of three elements: 123, 132, 213, and 312. The 8 such permutations of four elements are 1234, 1243, 1324, 1423, 2134, 2143, 3124, and 4123. - Joerg Arndt, Jun 24 2009
Catalan transform of A099087. - R. J. Mathar, Jun 29 2009
a(n) written in base 2: 1,10,100,1000,10000,..., i.e., (n+1) times 1, n times 0 (A011557(n)). - Jaroslav Krizek, Aug 02 2009
Or, phi(n) is equal to the number of perfect partitions of n. - Juri-Stepan Gerasimov, Oct 10 2009
These are the 2-smooth numbers, positive integers with no prime factors greater than 2. - Michael B. Porter, Oct 04 2009
A064614(a(n)) = A000244(n) and A064614(m) < A000244(n) for m < a(n). - Reinhard Zumkeller, Feb 08 2010
a(n) is the largest number m such that the number of steps of iterations of {r - (largest divisor d < r)} needed to reach 1 starting at r = m is equal to n. Example (a(5) = 32): 32 - 16 = 16; 16 - 8 = 8; 8 - 4 = 4; 4 - 2 = 2; 2 - 1 = 1; number 32 has 5 steps and is the largest such number. See A105017, A064097, A175125. - Jaroslav Krizek, Feb 15 2010
a(n) is the smallest proper multiple of a(n-1). - Dominick Cancilla, Aug 09 2010
The powers-of-2 triangle T(n, k), n >= 0 and 0 <= k <= n, begins with: {1}; {2, 4}; {8, 16, 32}; {64, 128, 256, 512}; ... . The first left hand diagonal T(n, 0) = A006125(n + 1), the first right hand diagonal T(n, n) = A036442(n + 1) and the center diagonal T(2*n, n) = A053765(n + 1). Some triangle sums, see A180662, are: Row1(n) = A122743(n), Row2(n) = A181174(n), Fi1(n) = A181175(n), Fi2(2*n) = A181175(2*n) and Fi2(2*n + 1) = 2*A181175(2*n + 1). - Johannes W. Meijer, Oct 10 2010
Records in the number of prime factors. - Juri-Stepan Gerasimov, Mar 12 2011
Row sums of A152538. - Gary W. Adamson, Dec 10 2008
A078719(a(n)) = 1; A006667(a(n)) = 0. - Reinhard Zumkeller, Oct 08 2011
The compositions of n in which each natural number is colored by one of p different colors are called p-colored compositions of n. For n>=1, a(n) equals the number of 2-colored compositions of n such that no adjacent parts have the same color. - Milan Janjic, Nov 17 2011
Equals A001405 convolved with its right-shifted variant: (1 + 2x + 4x^2 + ...) = (1 + x + 2x^2 + 3x^3 + 6x^4 + 10x^5 + ...) * (1 + x + x^2 + 2x^3 + 3x^4 + 6x^5 + ...). - Gary W. Adamson, Nov 23 2011
The number of odd-sized subsets of an n+1-set. For example, there are 2^3 odd-sized subsets of {1, 2, 3, 4}, namely {1}, {2}, {3}, {4}, {1, 2, 3}, {1, 2, 4}, {1, 3, 4}, and {2, 3, 4}. Also, note that 2^n = Sum_{k=1..floor((n+1)/2)} C(n+1, 2k-1). - Dennis P. Walsh, Dec 15 2011
a(n) is the number of 1's in any row of Pascal's triangle (mod 2) whose row number has exactly n 1's in its binary expansion (see A007318 and A047999). (The result of putting together A001316 and A000120.) - Marcus Jaiclin, Jan 31 2012
A204455(k) = 1 if and only if k is in this sequence. - Wolfdieter Lang, Feb 04 2012
For n>=1 apparently the number of distinct finite languages over a unary alphabet, whose minimum regular expression has alphabetic width n (verified up to n=17), see the Gruber/Lee/Shallit link. - Hermann Gruber, May 09 2012
First differences of A000225. - Omar E. Pol, Feb 19 2013
This is the lexicographically earliest sequence which contains no arithmetic progression of length 3. - Daniel E. Frohardt, Apr 03 2013
a(n-2) is the number of bipartitions of {1..n} (i.e., set partitions into two parts) such that 1 and 2 are not in the same subset. - Jon Perry, May 19 2013
Numbers n such that the n-th cyclotomic polynomial has a root mod 2; numbers n such that the n-th cyclotomic polynomial has an even number of odd coefficients. - Eric M. Schmidt, Jul 31 2013
More is known now about non-power-of-2 "Almost Perfect Numbers" as described in Dagal. - Jonathan Vos Post, Sep 01 2013
Number of symmetric Ferrers diagrams that fit into an n X n box. - Graham H. Hawkes, Oct 18 2013
Numbers n such that sigma(2n) = 2n + sigma(n). - Jahangeer Kholdi, Nov 23 2013
a(1), ..., a(floor(n/2)) are all values of permanent on set of square (0,1)-matrices of order n>=2 with row and column sums 2. - Vladimir Shevelev, Nov 26 2013
Numbers whose base-2 expansion has exactly one bit set to 1, and thus has base-2 sum of digits equal to one. - Stanislav Sykora, Nov 29 2013
A072219(a(n)) = 1. - Reinhard Zumkeller, Feb 20 2014
a(n) is the largest number k such that (k^n-2)/(k-2) is an integer (for n > 1); (k^a(n)+1)/(k+1) is never an integer (for k > 1 and n > 0). - Derek Orr, May 22 2014
If x = A083420(n), y = a(n+1) and z = A087289(n), then x^2 + 2*y^2 = z^2. - Vincenzo Librandi, Jun 09 2014
The mini-sequence b(n) = least number k > 0 such that 2^k ends in n identical digits is given by {1, 18, 39}. The repeating digits are {2, 4, 8} respectively. Note that these are consecutive powers of 2 (2^1, 2^2, 2^3), and these are the only powers of 2 (2^k, k > 0) that are only one digit. Further, this sequence is finite. The number of n-digit endings for a power of 2 with n or more digits id 4*5^(n-1). Thus, for b(4) to exist, one only needs to check exponents up to 4*5^3 = 500. Since b(4) does not exist, it is clear that no other number will exist. - Derek Orr, Jun 14 2014
The least number k > 0 such that 2^k ends in n consecutive decreasing digits is a 3-number sequence given by {1, 5, 25}. The consecutive decreasing digits are {2, 32, 432}. There are 100 different 3-digit endings for 2^k. There are no k-values such that 2^k ends in '987', '876', '765', '654', '543', '321', or '210'. The k-values for which 2^k ends in '432' are given by 25 mod 100. For k = 25 + 100*x, the digit immediately before the run of '432' is {4, 6, 8, 0, 2, 4, 6, 8, 0, 2, ...} for x = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...}, respectively. Thus, we see the digit before '432' will never be a 5. So, this sequence is complete. - Derek Orr, Jul 03 2014
a(n) is the number of permutations of length n avoiding both 231 and 321 in the classical sense which are breadth-first search reading words of increasing unary-binary trees. For more details, see the entry for permutations avoiding 231 at A245898. - Manda Riehl, Aug 05 2014
Numbers n such that sigma(n) = sigma(2n) - phi(4n). - Farideh Firoozbakht, Aug 14 2014
This is a B_2 sequence: for i < j, differences a(j) - a(i) are all distinct. Here 2*a(n) < a(n+1) + 1, so a(n) - a(0) < a(n+1) - a(n). - Thomas Ordowski, Sep 23 2014
a(n) counts n-walks (closed) on the graph G(1-vertex; 1-loop, 1-loop). - David Neil McGrath, Dec 11 2014
a(n-1) counts walks (closed) on the graph G(1-vertex; 1-loop, 2-loop, 3-loop, 4-loop, ...). - David Neil McGrath, Jan 01 2015
b(0) = 4; b(n+1) is the smallest number not in the sequence such that b(n+1) - Prod_{i=0..n} b(i) divides b(n+1) - Sum_{i=0..n} b(i). Then b(n) = a(n) for n > 2. - Derek Orr, Jan 15 2015
a(n) counts the permutations of length n+2 whose first element is 2 such that the permutation has exactly one descent. - Ran Pan, Apr 17 2015
a(0)-a(30) appear, with a(26)-a(30) in error, in tablet M 08613 (see CDLI link) from the Old Babylonian period (c. 1900-1600 BC). - Charles R Greathouse IV, Sep 03 2015
Subsequence of A028982 (the squares or twice squares sequence). - Timothy L. Tiffin, Jul 18 2016
A000120(a(n)) = 1. A000265(a(n)) = 1. A000593(a(n)) = 1. - Juri-Stepan Gerasimov, Aug 16 2016
Number of monotone maps f : [0..n] -> [0..n] which are order-increasing (i <= f(i)) and idempotent (f(f(i)) = f(i)). In other words, monads on the n-th ordinal (seen as a posetal category). Any monad f determines a subset of [0..n] that contains n, by considering its set of monad algebras = fixed points { i | f(i) = i }. Conversely, any subset S of [0..n] containing n determines a monad on [0..n], by the function i |-> min { j | i <= j, j in S }. - Noam Zeilberger, Dec 11 2016
Consider n points lying on a circle. Then for n>=2 a(n-2) gives the number of ways to connect two adjacent points with nonintersecting chords. - Anton Zakharov, Dec 31 2016
Satisfies Benford's law [Diaconis, 1977; Berger-Hill, 2017] - N. J. A. Sloane, Feb 07 2017
Also the number of independent vertex sets and vertex covers in the n-empty graph. - Eric W. Weisstein, Sep 21 2017
Also the number of maximum cliques in the n-halved cube graph for n > 4. - Eric W. Weisstein, Dec 04 2017
Number of pairs of compositions of n corresponding to a seaweed algebra of index n-1. - Nick Mayers, Jun 25 2018
The multiplicative group of integers modulo a(n) is cyclic if and only if n = 0, 1, 2. For n >= 3, it is a product of two cyclic groups. - Jianing Song, Jun 27 2018
k^n is the determinant of n X n matrix M_(i, j) = binomial(k + i + j - 2, j) - binomial(i+j-2, j), in this case k=2. - Tony Foster III, May 12 2019
Solutions to the equation Phi(2n + 2*Phi(2n)) = 2n. - M. Farrokhi D. G., Jan 03 2020
a(n-1) is the number of subsets of {1,2,...,n} which have an element that is the size of the set. For example, for n = 4, a(3) = 8 and the subsets are {1}, {1,2}, {2,3}, {2,4}, {1,2,3}, {1,3,4}, {2,3,4}, {1,2,3,4}. - Enrique Navarrete, Nov 21 2020
a(n) is the number of self-inverse (n+1)-order permutations with 231-avoiding. E.g., a(3) = 8: [1234, 1243, 1324, 1432, 2134, 2143, 3214, 4321]. - Yuchun Ji, Feb 26 2021
For any fixed k > 0, a(n) is the number of ways to tile a strip of length n+1 with tiles of length 1, 2, ... k, where the tile of length k can be black or white, with the restriction that the first tile cannot be black. - Greg Dresden and Bora Bursalı, Aug 31 2023

Examples

			There are 2^3 = 8 subsets of a 3-element set {1,2,3}, namely { -, 1, 2, 3, 12, 13, 23, 123 }.
		

References

  • Milton Abramowitz and Irene A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 1016.
  • Mohammad K. Azarian, A Generalization of the Climbing Stairs Problem, Mathematics and Computer Education Journal, Vol. 31, No. 1, pp. 24-28, Winter 1997.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See pp. 73, 84.
  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §4.5 Logarithms and §8.1 Terminology, pp. 150, 264.
  • Paul J. Nahin, An Imaginary Tale: The Story of sqrt(-1), Princeton University Press, Princeton, NJ. 1998, pp. 69-70.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, page 273.
  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 124.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • V. E. Tarakanov, Combinatorial problems on binary matrices, Combin. Analysis, MSU, 5 (1980), 4-15. (Russian)
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 141.
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 55.

Crossrefs

This is the Hankel transform (see A001906 for the definition) of A000984, A002426, A026375, A026387, A026569, A026585, A026671 and A032351. - John W. Layman, Jul 31 2000
Euler transform of A001037, A209406 (multisets), inverse binomial transform of A000244, binomial transform of A000012.
Complement of A057716.
Boustrophedon transforms: A000734, A000752.
Range of values of A006519, A007875, A011782, A030001, A034444, A037445, A053644, and A054243.
Cf. A018900, A014311, A014312, A014313, A023688, A023689, A023690, A023691 (sum of 2, ..., 9 distinct powers of 2).
Cf. A090129.
The following are parallel families: A000079 (2^n), A004094 (2^n reversed), A028909 (2^n sorted up), A028910 (2^n sorted down), A036447 (double and reverse), A057615 (double and sort up), A263451 (double and sort down); A000244 (3^n), A004167 (3^n reversed), A321540 (3^n sorted up), A321539 (3^n sorted down), A163632 (triple and reverse), A321542 (triple and sort up), A321541 (triple and sort down).

Programs

  • Haskell
    a000079 = (2 ^)
    a000079_list = iterate (* 2) 1
    -- Reinhard Zumkeller, Jan 22 2014, Mar 05 2012, Dec 29 2011
    
  • Magma
    [2^n: n in [0..40]]; // Vincenzo Librandi, Feb 17 2014
    
  • Magma
    [n le 2 select n else 5*Self(n-1)-6*Self(n-2): n in [1..40]]; // Vincenzo Librandi, Feb 17 2014
    
  • Maple
    A000079 := n->2^n; [ seq(2^n,n=0..50) ];
    isA000079 := proc(n)
        local fs;
        fs := numtheory[factorset](n) ;
        if n = 1 then
            true ;
        elif nops(fs) <> 1 then
            false;
        elif op(1,fs) = 2 then
            true;
        else
            false ;
        end if;
    end proc: # R. J. Mathar, Jan 09 2017
  • Mathematica
    Table[2^n, {n, 0, 50}]
    2^Range[0, 50] (* Wesley Ivan Hurt, Jun 14 2014 *)
    LinearRecurrence[{2}, {2}, {0, 20}] (* Eric W. Weisstein, Sep 21 2017 *)
    CoefficientList[Series[1/(1 - 2 x), {x, 0, 20}], x] (* Eric W. Weisstein, Sep 21 2017 *)
    NestList[2# &, 1, 40] (* Harvey P. Dale, Oct 07 2019 *)
  • Maxima
    A000079(n):=2^n$ makelist(A000079(n),n,0,30); /* Martin Ettl, Nov 05 2012 */
    
  • PARI
    A000079(n)=2^n \\ Edited by M. F. Hasler, Aug 27 2014
    
  • PARI
    unimodal(n)=local(x,d,um,umc); umc=0; for (c=0,n!-1, x=numtoperm(n,c); d=0; um=1; for (j=2,n,if (x[j]x[j-1] && d==1,um=0); if (um==0,break)); if (um==1,print(x)); umc+=um); umc
    
  • Python
    def a(n): return 1<Michael S. Branicky, Jul 28 2022
    
  • Python
    def is_powerof2(n) -> bool: return n and (n & (n - 1)) == 0  # Peter Luschny, Apr 10 2025
  • Scala
    (List.fill(20)(2: BigInt)).scanLeft(1: BigInt)( * ) // Alonso del Arte, Jan 16 2020
    
  • Scheme
    (define (A000079 n) (expt 2 n)) ;; Antti Karttunen, Mar 21 2017
    

Formula

a(n) = 2^n.
a(0) = 1; a(n) = 2*a(n-1).
G.f.: 1/(1 - 2*x).
E.g.f.: exp(2*x).
a(n)= Sum_{k = 0..n} binomial(n, k).
a(n) is the number of occurrences of n in A000523. a(n) = A001045(n) + A001045(n+1). a(n) = 1 + Sum_{k = 0..(n - 1)} a(k). The Hankel transform of this sequence gives A000007 = [1, 0, 0, 0, 0, 0, ...]. - Philippe Deléham, Feb 25 2004
n such that phi(n) = n/2, for n > 1, where phi is Euler's totient (A000010). - Lekraj Beedassy, Sep 07 2004
a(n + 1) = a(n) XOR 3*a(n) where XOR is the binary exclusive OR operator. - Philippe Deléham, Jun 19 2005
a(n) = StirlingS2(n + 1, 2) + 1. - Ross La Haye, Jan 09 2008
a(n+2) = 6a(n+1) - 8a(n), n = 1, 2, 3, ... with a(1) = 1, a(2) = 2. - Yosu Yurramendi, Aug 06 2008
a(n) = ka(n-1) + (4 - 2k)a(n-2) for any integer k and n > 1, with a(0) = 1, a(1) = 2. - Jaume Oliver Lafont, Dec 05 2008
a(n) = Sum_{l_1 = 0..n + 1} Sum_{l_2 = 0..n}...Sum_{l_i = 0..n - i}...Sum_{l_n = 0..1} delta(l_1, l_2, ..., l_i, ..., l_n) where delta(l_1, l_2, ..., l_i, ..., l_n) = 0 if any l_i <= l_(i+1) and l_(i+1) != 0 and delta(l_1, l_2, ..., l_i, ..., l_n) = 1 otherwise. - Thomas Wieder, Feb 25 2009
a(0) = 1, a(1) = 2; a(n) = a(n-1)^2/a(n-2), n >= 2. - Jaume Oliver Lafont, Sep 22 2009
a(n) = A173786(n, n)/2 = A173787(n + 1, n). - Reinhard Zumkeller, Feb 28 2010
If p[i] = i - 1 and if A is the Hessenberg matrix of order n defined by: A[i, j] = p[j - i + 1], (i <= j), A[i, j] = -1, (i = j + 1), and A[i, j] = 0 otherwise. Then, for n >= 1, a(n-1) = det A. - Milan Janjic, May 02 2010
If p[i] = Fibonacci(i-2) and if A is the Hessenberg matrix of order n defined by: A[i, j] = p[j - i + 1], (i <= j), A[i, j] = -1, (i = j + 1), and A[i, j] = 0 otherwise. Then, for n >= 2, a(n-2) = det A. - Milan Janjic, May 08 2010
The sum of reciprocals, 1/1 + 1/2 + 1/4 + 1/8 + ... + 1/(2^n) + ... = 2. - Mohammad K. Azarian, Dec 29 2010
a(n) = 2*A001045(n) + A078008(n) = 3*A001045(n) + (-1)^n. - Paul Barry, Feb 20 2003
a(n) = A118654(n, 2).
a(n) = A140740(n+1, 1).
a(n) = A131577(n) + A011782(n) = A024495(n) + A131708(n) + A024493(n) = A000749(n) + A038503(n) + A038504(n) + A038505(n) = A139761(n) + A139748(n) + A139714(n) + A133476(n) + A139398(n). - Paul Curtz, Jul 25 2011
a(n) = row sums of A007318. - Susanne Wienand, Oct 21 2011
a(n) = Hypergeometric([-n], [], -1). - Peter Luschny, Nov 01 2011
G.f.: A(x) = B(x)/x, B(x) satisfies B(B(x)) = x/(1 - x)^2. - Vladimir Kruchinin, Nov 10 2011
a(n) = Sum_{k = 0..n} A201730(n, k)*(-1)^k. - Philippe Deléham, Dec 06 2011
2^n = Sum_{k = 1..floor((n+1)/2)} C(n+1, 2k-1). - Dennis P. Walsh, Dec 15 2011
A209229(a(n)) = 1. - Reinhard Zumkeller, Mar 07 2012
A001227(a(n)) = 1. - Reinhard Zumkeller, May 01 2012
Sum_{n >= 1} mobius(n)/a(n) = 0.1020113348178103647430363939318... - R. J. Mathar, Aug 12 2012
E.g.f.: 1 + 2*x/(U(0) - x) where U(k) = 6*k + 1 + x^2/(6*k+3 + x^2/(6*k + 5 + x^2/U(k+1) )); (continued fraction, 3-step). - Sergei N. Gladkovskii, Dec 04 2012
a(n) = det(|s(i+2,j)|, 1 <= i,j <= n), where s(n,k) are Stirling numbers of the first kind. - Mircea Merca, Apr 04 2013
a(n) = det(|ps(i+1,j)|, 1 <= i,j <= n), where ps(n,k) are Legendre-Stirling numbers of the first kind (A129467). - Mircea Merca, Apr 06 2013
G.f.: W(0), where W(k) = 1 + 2*x*(k+1)/(1 - 2*x*(k+1)/( 2*x*(k+2) + 1/W(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Aug 28 2013
a(n-1) = Sum_{t_1 + 2*t_2 + ... + n*t_n = n} multinomial(t_1 + t_2 + ... + t_n; t_1, t_2, ..., t_n). - Mircea Merca, Dec 06 2013
Construct the power matrix T(n,j) = [A^*j]*[S^*(j-1)] where A(n)=(1,1,1,...) and S(n)=(0,1,0,0,...) (where * is convolution operation). Then a(n-1) = Sum_{j=1..n} T(n,j). - David Neil McGrath, Jan 01 2015
a(n) = A000005(A002110(n)). - Ivan N. Ianakiev, May 23 2016
From Ilya Gutkovskiy, Jul 18 2016: (Start)
Exponential convolution of A000012 with themselves.
a(n) = Sum_{k=0..n} A011782(k).
Sum_{n>=0} a(n)/n! = exp(2) = A072334.
Sum_{n>=0} (-1)^n*a(n)/n! = exp(-2) = A092553. (End)
G.f.: (r(x) * r(x^2) * r(x^4) * r(x^8) * ...) where r(x) = A090129(x) = (1 + 2x + 2x^2 + 4x^3 + 8x^4 + ...). - Gary W. Adamson, Sep 13 2016
a(n) = A000045(n + 1) + A000045(n) + Sum_{k = 0..n - 2} A000045(k + 1)*2^(n - 2 - k). - Melvin Peralta, Dec 22 2017
a(n) = 7*A077020(n)^2 + A077021(n)^2, n>=3. - Ralf Steiner, Aug 08 2021
a(n)= n + 1 + Sum_{k=3..n+1} (2*k-5)*J(n+2-k), where Jacobsthal number J(n) = A001045(n). - Michael A. Allen, Jan 12 2022
Integral_{x=0..Pi} cos(x)^n*cos(n*x) dx = Pi/a(n) (see Nahin, pp. 69-70). - Stefano Spezia, May 17 2023

Extensions

Clarified a comment T. D. Noe, Aug 30 2009
Edited by Daniel Forgues, May 12 2010
Incorrect comment deleted by Matthew Vandermast, May 17 2014
Comment corrected to match offset by Geoffrey Critzer, Nov 28 2014

A001969 Evil numbers: nonnegative integers with an even number of 1's in their binary expansion.

Original entry on oeis.org

0, 3, 5, 6, 9, 10, 12, 15, 17, 18, 20, 23, 24, 27, 29, 30, 33, 34, 36, 39, 40, 43, 45, 46, 48, 51, 53, 54, 57, 58, 60, 63, 65, 66, 68, 71, 72, 75, 77, 78, 80, 83, 85, 86, 89, 90, 92, 95, 96, 99, 101, 102, 105, 106, 108, 111, 113, 114, 116, 119, 120, 123, 125, 126, 129
Offset: 1

Views

Author

Keywords

Comments

This sequence and A000069 give the unique solution to the problem of splitting the nonnegative integers into two classes in such a way that sums of pairs of distinct elements from either class occur with the same multiplicities [Lambek and Moser]. Cf. A000028, A000379.
In French: les nombres païens.
Theorem: First differences give A036585. (Observed by Franklin T. Adams-Watters.)
Proof from Max Alekseyev, Aug 30 2006 (edited by N. J. A. Sloane, Jan 05 2021): (Start)
Observe that if the last bit of a(n) is deleted, we get the nonnegative numbers 0, 1, 2, 3, ... in order.
The last bit in a(n+1) is 1 iff the number of bits in n is odd, that is, iff A010060(n+1) is 1.
So, taking into account the different offsets here and in A010060, we have a(n) = 2*(n-1) + A010060(n-1).
Therefore the first differences of the present sequence equal 2 + first differences of A010060, which equals A036585. QED (End)
Integers k such that A010060(k-1)=0. - Benoit Cloitre, Nov 15 2003
Indices of zeros in the Thue-Morse sequence A010060 shifted by 1. - Tanya Khovanova, Feb 13 2009
Conjecture, checked up to 10^6: a(n) is also the sequence of numbers k representable as k = ror(x) XOR rol(x) (for some integer x) where ror(x)=A038572(x) is x rotated one binary place to the right, rol(x)=A006257(x) is x rotated one binary place to the left, and XOR is the binary exclusive-or operator. - Alex Ratushnyak, May 14 2016
From Charlie Neder, Oct 07 2018: (Start)
Conjecture is true: ror(x) and rol(x) have an even number of 1 bits in total (= 2 * A000120(x)), and XOR preserves the parity of this total, so the resulting number must have an even number of 1 bits. An x can be constructed corresponding to a(n) like so:
If the number of bits in a(n) is even, add a leading 0 so a(n) is 2k+1 bits long.
Do an inverse shuffle on a(n), then "divide" by 11, rotate the result k bits to the right, and shuffle to get x. (End)
Numbers of the form m XOR (2*m) for some m >= 0. - Rémy Sigrist, Feb 07 2021
The terms "evil numbers" and "odious numbers" were coined by Richard K. Guy, c. 1976 (Haque and Shallit, 2016) and appeared in the book by Berlekamp et al. (Vol. 1, 1st ed., 1982). - Amiram Eldar, Jun 08 2021

References

  • Elwyn R. Berlekamp, John H. Conway, Richard K. Guy, Winning Ways for Your Mathematical Plays, Volume 1, 2nd ed., A K Peters, 2001, chapter 14, p. 110.
  • Hugh L. Montgomery, Ten Lectures on the Interface Between Analytic Number Theory and Harmonic Analysis, Amer. Math. Soc., 1996, p. 208.
  • Donald J. Newman, A Problem Seminar, Springer; see Problem #89.
  • Vladimir S. Shevelev, On some identities connected with the partition of the positive integers with respect to the Morse sequence, Izv. Vuzov of the North-Caucasus region, Nature sciences 4 (1997), 21-23 (Russian).
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Complement of A000069 (the odious numbers). Cf. A133009.
a(n)=2*n+A010060(n)=A000069(n)-(-1)^A010060(n). Cf. A018900.
The basic sequences concerning the binary expansion of n are A000120, A000788, A000069, A001969, A023416, A059015.
Cf. A036585 (differences), A010060, A006364.
For primes see A027699, also A130593.

Programs

  • Haskell
    a001969 n = a001969_list !! (n-1)
    a001969_list = [x | x <- [0..], even $ a000120 x]
    -- Reinhard Zumkeller, Feb 01 2012
    
  • Magma
    [ n : n in [0..129] | IsEven(&+Intseq(n,2)) ]; // Sergei Haller (sergei(AT)sergei-haller.de), Dec 21 2006
    
  • Maple
    s := proc(n) local i,j,ans; ans := [ ]; j := 0; for i from 0 while jA001969 := n->t1[n]; # s(k) gives first k terms.
    # Alternative:
    seq(`if`(add(k, k=convert(n,base,2))::even, n, NULL), n=0..129); # Peter Luschny, Jan 15 2021
    # alternative for use outside this sequence
    isA001969 := proc(n)
        add(d,d=convert(n,base,2)) ;
        type(%,'even') ;
    end proc:
    A001969 := proc(n)
        option remember ;
        local a;
        if n = 0 then
            1;
        else
            for a from procname(n-1)+1 do
                if isA001969(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A001969(n),n=1..200) ; # R. J. Mathar, Aug 07 2022
  • Mathematica
    Select[Range[0,300], EvenQ[DigitCount[ #, 2][[1]]] &]
    a[ n_] := If[ n < 1, 0, With[{m = n - 1}, 2 m + Mod[-Total@IntegerDigits[m, 2], 2]]]; (* Michael Somos, Jun 09 2019 *)
  • PARI
    a(n)=n-=1; 2*n+subst(Pol(binary(n)),x,1)%2
    
  • PARI
    a(n)=if(n<1,0,if(n%2==0,a(n/2)+n,-a((n-1)/2)+3*n))
    
  • PARI
    a(n)=2*(n-1)+hammingweight(n-1)%2 \\ Charles R Greathouse IV, Mar 22 2013
    
  • Python
    def ok(n): return bin(n)[2:].count('1') % 2 == 0
    print(list(filter(ok, range(130)))) # Michael S. Branicky, Jun 02 2021
    
  • Python
    from itertools import chain, count, islice
    def A001969_gen(): # generator of terms
        return chain((0,),chain.from_iterable((sorted(n^ n<<1 for n in range(2**l,2**(l+1))) for l in count(0))))
    A001969_list = list(islice(A001969_gen(),30)) # Chai Wah Wu, Jun 29 2022
    
  • Python
    def A001969(n): return ((m:=n-1).bit_count()&1)+(m<<1) # Chai Wah Wu, Mar 03 2023

Formula

a(n+1) - A001285(n) = 2n-1 has been verified for n <= 400. - John W. Layman, May 16 2003 [This can be directly verified by comparing Ralf Stephan's formulas for this sequence (see below) and for A001285. - Jianing Song, Nov 04 2024]
Note that 2n+1 is in the sequence iff 2n is not and so this sequence has asymptotic density 1/2. - Franklin T. Adams-Watters, Aug 23 2006
a(n) = (1/2) * (4n - 3 - (-1)^A000120(n-1)). - Ralf Stephan, Sep 14 2003
G.f.: Sum_{k>=0} (t(3+2t+3t^2)/(1-t^2)^2) * Product_{l=0..k-1} (1-x^(2^l)), where t = x^2^k. - Ralf Stephan, Mar 25 2004
a(2*n+1) + a(2*n) = A017101(n-1) = 8*n-5.
a(2*n) - a(2*n-1) gives the Thue-Morse sequence (3, 1 version): 3, 1, 1, 3, 1, 3, 3, 1, 1, 3, .... A001969(n) + A000069(n) = A016813(n-1) = 4*n-3. - Philippe Deléham, Feb 04 2004
a(1) = 0; for n > 1: a(n) = 3*n-3 - a(n/2) if n even, a(n) = a((n+1)/2)+n-1 if n odd.
Let b(n) = 1 if sum of digits of n is even, -1 if it is odd; then Shallit (1985) showed that Product_{n>=0} ((2n+1)/(2n+2))^b(n) = 1/sqrt(2).
a(n) = 2n - 2 + A010060(n-1). - Franklin T. Adams-Watters, Aug 28 2006
A005590(a(n-1)) <= 0. - Reinhard Zumkeller, Apr 11 2012
A106400(a(n-1)) = 1. - Reinhard Zumkeller, Apr 29 2012
a(n) = (a(n-1) + 2) XOR A010060(a(n-1) + 2). - Falk Hüffner, Jan 21 2022
a(n+1) = A006068(n) XOR (2*A006068(n)). - Rémy Sigrist, Apr 14 2022

Extensions

More terms from Robin Trew (trew(AT)hcs.harvard.edu)

A014311 Numbers with exactly 3 ones in binary expansion.

Original entry on oeis.org

7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 67, 69, 70, 73, 74, 76, 81, 82, 84, 88, 97, 98, 100, 104, 112, 131, 133, 134, 137, 138, 140, 145, 146, 148, 152, 161, 162, 164, 168, 176, 193, 194, 196, 200, 208, 224, 259, 261, 262, 265, 266, 268, 273, 274, 276, 280, 289, 290, 292, 296, 304
Offset: 1

Views

Author

Al Black (gblack(AT)nol.net)

Keywords

Comments

Equivalently, sums of three distinct powers of 2.
Appears to give all n such that 64 is the highest power of 2 dividing A005148(n). - Benoit Cloitre, Jun 22 2002
From Gus Wiseman, Oct 05 2020: (Start)
These are numbers k such that the k-th composition in standard order has length 3. The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions. The sequence together with the corresponding standard compositions begins:
7: (1,1,1) 44: (2,1,3) 97: (1,5,1)
11: (2,1,1) 49: (1,4,1) 98: (1,4,2)
13: (1,2,1) 50: (1,3,2) 100: (1,3,3)
14: (1,1,2) 52: (1,2,3) 104: (1,2,4)
19: (3,1,1) 56: (1,1,4) 112: (1,1,5)
21: (2,2,1) 67: (5,1,1) 131: (6,1,1)
22: (2,1,2) 69: (4,2,1) 133: (5,2,1)
25: (1,3,1) 70: (4,1,2) 134: (5,1,2)
26: (1,2,2) 73: (3,3,1) 137: (4,3,1)
28: (1,1,3) 74: (3,2,2) 138: (4,2,2)
35: (4,1,1) 76: (3,1,3) 140: (4,1,3)
37: (3,2,1) 81: (2,4,1) 145: (3,4,1)
38: (3,1,2) 82: (2,3,2) 146: (3,3,2)
41: (2,3,1) 84: (2,2,3) 148: (3,2,3)
42: (2,2,2) 88: (2,1,4) 152: (3,1,4)
(End)

Crossrefs

Cf. A038465 (base 3), A038471 (base 4), A038475 (base 5).
Cf. A081091 (primes), A212190 (squares), A212192 (triangular numbers), A173589 (Fibbinary).
Cf. A057168.
Cf. A000079, A018900, A014311, A014312, A014313, A023688, A023689, A023690, A023691 (Hammingweight = 1, 2, ..., 9).
A000217(n-2) counts compositions into three parts.
A001399(n-3) = A069905(n) = A211540(n+2) counts the unordered case.
A001399(n-6) = A069905(n-3) = A211540(n-1) counts the unordered strict case.
A001399(n-6)*6 = A069905(n-3)*6 = A211540(n-1)*6 counts the strict case.
A014612 is an unordered version, with strict case A007304.
A337453 is the strict case.
A337461 counts the coprime case.
A033992 lists numbers divisible by exactly three different primes.
A323024 lists numbers with exactly three different prime multiplicities.

Programs

  • C
    unsigned hakmem175(unsigned x) {
        unsigned s, o, r;
        s = x & -x;  r = x + s;
        o = r ^ x;  o = (o >> 2) / s;
        return r | o;
    }
    unsigned A014311(int n) {
        if (n == 1) return 7;
        return hakmem175(A014311(n - 1));
    }  // Peter Luschny, Jan 01 2014
    
  • Haskell
    a014311 n = a014311_list !! (n-1)
    a014311_list = [2^x + 2^y + 2^z |
                    x <- [2..], y <- [1..x-1], z <- [0..y-1]]
    -- Reinhard Zumkeller, May 03 2012
    
  • Mathematica
    Select[Range[200], (Count[IntegerDigits[#, 2], 1] == 3)&]
    nn = 8; Flatten[Table[2^i + 2^j + 2^k, {i, 2, nn}, {j, 1, i - 1}, {k, 0, j - 1}]] (* T. D. Noe, Nov 05 2013 *)
  • PARI
    for(n=0,10^3,if(hammingweight(n)==3,print1(n,", "))); \\ Joerg Arndt, Mar 04 2014
    
  • PARI
    print1(t=7);for(i=2,50,print1(","t=A057168(t))) \\ M. F. Hasler, Aug 27 2014
    
  • Python
    A014311_list = [2**a+2**b+2**c for a in range(2,6) for b in range(1,a) for c in range(b)] # Chai Wah Wu, Jan 24 2021
    
  • Python
    from itertools import islice
    def A014311_gen(): # generator of terms
        yield (n:=7)
        while True: yield (n:=n^((a:=-n&n+1)|(a>>1)) if n&1 else ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b)
    A014311_list = list(islice(A014311_gen(),20)) # Chai Wah Wu, Mar 10 2025
    
  • Python
    from math import isqrt, comb
    from sympy import integer_nthroot
    def A014311(n): return (1<<(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))+(1<<(a:=isqrt(s:=n-comb(m-(t^1)+2,3)<<1))+((s<<2)>(a<<2)*(a+1)+1))+(1<Chai Wah Wu, Mar 10 2025

Formula

A000120(a(n)) = 3. - Reinhard Zumkeller, May 03 2012
Start with A084468. If n is in sequence, then 2n is too. - Ralf Stephan, Aug 16 2013
a(n+1) = A057168(a(n)). - M. F. Hasler, Aug 27 2014
a(n) = 2^A056558(n-1) + 2^A194848(n-1) + 2^A194847(n-1). - Ridouane Oudra, Sep 06 2020
Sum_{n>=1} 1/a(n) = A367110 = 1.428591545852638123996854844400537952781688750906133068397189529775365950039... (calculated using Baillie's irwinSums.m, see Links). - Amiram Eldar, Feb 14 2022

Extensions

Extension and program by Olivier Gérard

A052224 Numbers whose sum of digits is 10.

Original entry on oeis.org

19, 28, 37, 46, 55, 64, 73, 82, 91, 109, 118, 127, 136, 145, 154, 163, 172, 181, 190, 208, 217, 226, 235, 244, 253, 262, 271, 280, 307, 316, 325, 334, 343, 352, 361, 370, 406, 415, 424, 433, 442, 451, 460, 505, 514, 523, 532, 541, 550, 604, 613, 622, 631, 640
Offset: 1

Views

Author

Henry Bottomley, Feb 01 2000

Keywords

Comments

Proper subsequence of A017173. - Rick L. Shepherd, Jan 12 2009
Subsequence of A227793. - Michel Marcus, Sep 23 2013
A007953(a(n)) = 10; number of repdigits = #{55,22222,1^10} = A242627(10) = 3. - Reinhard Zumkeller, Jul 17 2014
a(n) = A094677(n) for n = 1..28. - Reinhard Zumkeller, Nov 08 2015
The number of terms having <= m digits is the coefficient of x^10 in sum(i=0,9,x^i)^m = ((1-x^10)/(1-x))^m. - David A. Corneth, Jun 04 2016
In general, the set of numbers with sum of base-b digits equal to b is a subset of { (b-1)*k + 1; k = 2, 3, 4, ... }. - M. F. Hasler, Dec 23 2016

Crossrefs

Cf. A011557 (1), A052216 (2), A052217 (3), A052218 (4), A052219 (5), A052220 (6), A052221 (7), A052222 (8), A052223 (9), A166311 (11), A235151 (12), A143164 (13), A235225 (14), A235226 (15), A235227 (16), A166370 (17), A235228 (18), A166459 (19), A235229 (20).
Cf. A094677.
Sum of base-b digits equal b: A226636 (b = 3), A226969 (b = 4), A227062 (b = 5), A227080 (b = 6), A227092 (b = 7), A227095 (b = 8), A227238 (b = 9).

Programs

  • Haskell
    a052224 n = a052224_list !! (n-1)
    a052224_list = filter ((== 10) . a007953) [0..]
    -- Reinhard Zumkeller, Jul 17 2014
    
  • Magma
    [n: n in [1..1000] | &+Intseq(n) eq 10 ]; // Vincenzo Librandi, Mar 10 2013
    
  • Maple
    sd := proc (n) options operator, arrow: add(convert(n, base, 10)[j], j = 1 .. nops(convert(n, base, 10))) end proc: a := proc (n) if sd(n) = 10 then n else end if end proc: seq(a(n), n = 1 .. 800); # Emeric Deutsch, Jan 16 2009
  • Mathematica
    Union[Flatten[Table[FromDigits /@ Permutations[PadRight[s, 7]], {s, Rest[IntegerPartitions[10]]}]]] (* T. D. Noe, Mar 08 2013 *)
    Select[Range[1000], Total[IntegerDigits[#]] == 10 &] (* Vincenzo Librandi, Mar 10 2013 *)
  • PARI
    isok(n) = sumdigits(n) == 10; \\ Michel Marcus, Dec 28 2015
    
  • PARI
    \\ This algorithm needs a modified binomial.
    C(n, k)=if(n>=k, binomial(n, k), 0)
    \\ ways to roll s-q with q dice having sides 0 through n - 1.
    b(s, q, n)=if(s<=q*(n-1), s+=q; sum(i=0, q-1, (-1)^i*C(q, i)*C(s-1-n*i, q-1)), 0)
    \\ main algorithm; this program applies to all sequences of the form "Numbers whose sum of digits is m."
    a(n,{m=10}) = {my(q); q = 2; while(b(m, q, 10) < n, q++); q--; s = m; os = m; r=0; while(q, if(b(s, q, 10) < n, n-=b(s, q, 10); s--, r+=(os-s)*10^(q); os = s; q--)); r+= s; r}
    \\ David A. Corneth, Jun 05 2016
    
  • Python
    from sympy.utilities.iterables import multiset_permutations
    def auptodigs(maxdigits, b=10, sod=10): # works for any base, sum-of-digits
        alst = [sod] if 0 <= sod < b else []
        nzdigs = [i for i in range(1, b) if i <= sod]
        nzmultiset = []
        for d in range(1, b):
            nzmultiset += [d]*(sod//d)
        for d in range(2, maxdigits + 1):
            fullmultiset = [0]*(d-1-(sod-1)//(b-1)) + nzmultiset
            for firstdig in nzdigs:
                target_sum, restmultiset = sod - int(firstdig), fullmultiset[:]
                restmultiset.remove(firstdig)
                for p in multiset_permutations(restmultiset, d-1):
                  if sum(p) == target_sum:
                      alst.append(int("".join(map(str, [firstdig]+p)), b))
                      if p[0] == target_sum:
                          break
        return alst
    print(auptodigs(4)) # Michael S. Branicky, Sep 14 2021
    
  • Python
    def A052224(N = 19):
        """Return a generator of the sequence of all integers >= N with the same
        digit sum as N."""
        while True:
            yield N
            N = A228915(N) # skip to next larger integer with the same digit sum
    a = A052224(); [next(a) for  in range(50)] # _M. F. Hasler, Mar 16 2022

Formula

a(n+1) = A228915(a(n)) for any n > 0. - Rémy Sigrist, Jul 10 2018

Extensions

Incorrect formula deleted by N. J. A. Sloane, Jan 15 2009
Extended by Emeric Deutsch, Jan 16 2009
Offset changed by Bruno Berselli, Mar 07 2013

A048645 Integers with one or two 1-bits in their binary expansion.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, 18, 20, 24, 32, 33, 34, 36, 40, 48, 64, 65, 66, 68, 72, 80, 96, 128, 129, 130, 132, 136, 144, 160, 192, 256, 257, 258, 260, 264, 272, 288, 320, 384, 512, 513, 514, 516, 520, 528, 544, 576, 640, 768, 1024, 1025, 1026, 1028, 1032
Offset: 1

Views

Author

Antti Karttunen, Jul 14 1999

Keywords

Comments

Apart from initial 1, sums of two not necessarily distinct powers of 2.
4 does not divide C(2s-1,s) (= A001700[ s ]) if and only if s=a(n).
Possible number of sides of a regular polygon such that there exists a triangulation where each triangle is isosceles. - Sen-peng Eu, May 07 2008
Also numbers n such that n!/2^(n-2) is an integer. - Michel Lagneau, Mar 28 2011
It appears these are also the indices of the terms that are shared by the cellular automata of A147562, A162795, A169707. - Omar E. Pol, Feb 21 2015
Numbers with binary weight 1 or 2. - Omar E. Pol, Feb 22 2015

Examples

			From _Omar E. Pol_, Feb 18 2015: (Start)
Also, written as a triangle T(j,k), k >= 1, in which row lengths are the terms of A028310:
   1;
   2;
   3,  4;
   5,  6,  8;
   9, 10, 12, 16;
  17, 18, 20, 24, 32;
  33, 34, 36, 40, 48, 64;
  65, 66, 68, 72, 80, 96, 128;
  ...
It appears that column 1 is A094373.
It appears that the right border gives A000079.
It appears that the first differences in every row that contains at least two terms give the first h-1 powers of 2, where h is the length of the row.
(End)
		

Crossrefs

Programs

  • Haskell
    import Data.List (insert)
    a048645 n k = a048645_tabl !! (n-1) !! (k-1)
    a048645_row n = a048645_tabl !! (n-1)
    a048645_tabl = iterate (\xs -> insert (2 * head xs + 1) $ map ((* 2)) xs) [1]
    a048645_list = concat a048645_tabl
    -- Reinhard Zumkeller, Dec 19 2012
    
  • 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,2,1000); # Zerinvary Lajos, Feb 24 2007
  • Mathematica
    Select[Range[2000], 1 <= DigitCount[#, 2, 1] <= 2&] (* Jean-François Alcover, Mar 06 2016 *)
  • PARI
    isok(n) = my(hw = hammingweight(n)); (hw == 1) || (hw == 2); \\ Michel Marcus, Mar 06 2016
    
  • PARI
    a(n) = if(n <= 2, return(n), n-=2); my(c = (sqrtint(8*n + 1) - 1) \ 2); 1 << c + 1 << (n - binomial(c + 1, 2)) \\ David A. Corneth, Jan 02 2019
    
  • PARI
    nxt(n) = msb = 1 << logint(n, 2); if(n == msb, n + 1, t = n - msb; n + t) \\ David A. Corneth, Jan 02 2019
    
  • Python
    def ok(n): return 1 <= bin(n)[2:].count('1') <= 2
    print([k for k in range(1033) if ok(k)]) # Michael S. Branicky, Jan 22 2022
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        for d in count(0):
            msb = 2**d
            yield msb
            for lsb in range(d):
                yield msb + 2**lsb
    print(list(islice(agen(), 60))) # Michael S. Branicky, Jan 22 2022
    
  • Python
    from math import isqrt, comb
    def A048645(n): return (1<<(m:=isqrt(n-1<<3)+1>>1)-1)+(1<<(n-2-comb(m,2))) if n>1 else 1 # Chai Wah Wu, Oct 30 2024

Formula

a(0) = 1, a(n) = (2^(trinv(n-1)-1) + 2^((n-1)-((trinv(n-1)*(trinv(n-1)-1))/2))), i.e., 2^A003056(n) + 2^A002262(n-1) (the latter sequence contains the definition of trinv).
Let Theta = Sum_{k >= 0} x^(2^k). Then Sum_{n>=1} x^a(n) = (Theta^2 + Theta + x)/2. - N. J. A. Sloane, Jun 23 2009
As a triangle, for n > 1, 1 < k <= n: T(n,1) = A173786(n-2,n-2) and T(n,k) = A173786(n-1,k-2). - Reinhard Zumkeller, Feb 28 2010
It appears that A147562(a(n)) = A162795(a(n)) = A169707(a(n)). - Omar E. Pol, Feb 19 2015
Sum_{n>=1} 1/a(n) = 2 + A179951. - Amiram Eldar, Jan 22 2022

A057168 Next larger integer with same binary weight (number of 1 bits) as n.

Original entry on oeis.org

2, 4, 5, 8, 6, 9, 11, 16, 10, 12, 13, 17, 14, 19, 23, 32, 18, 20, 21, 24, 22, 25, 27, 33, 26, 28, 29, 35, 30, 39, 47, 64, 34, 36, 37, 40, 38, 41, 43, 48, 42, 44, 45, 49, 46, 51, 55, 65, 50, 52, 53, 56, 54, 57, 59, 67, 58, 60, 61, 71, 62, 79, 95, 128, 66, 68, 69, 72, 70, 73, 75
Offset: 1

Views

Author

Marc LeBrun, Sep 14 2000

Keywords

Comments

Binary weight is given by A000120.

Examples

			a(6)=9 since 6 has two one-bits (i.e., 6=2+4) and 9 is the next higher integer of binary weight two (7 is weight three and 8 is weight one).
		

References

  • Donald Knuth, The Art of Computer Programming, Vol. 4A, section 7.1.3, exercises 20-21.

Crossrefs

Programs

  • Haskell
    a057168 n = a057168_list !! (n-1)
    a057168_list = f 2 $ tail a000120_list where
       f x (z:zs) = (x + length (takeWhile (/= z) zs)) : f (x + 1) zs
    -- Reinhard Zumkeller, Aug 26 2012
    
  • Mathematica
    a[n_] := (bw = DigitCount[n, 2, 1]; k = n+1; While[ DigitCount[k, 2, 1] != bw, k++]; k); Table[a[n], {n, 1, 71}](* Jean-François Alcover, Nov 28 2011 *)
  • PARI
    a(n)=my(u=bitand(n,-n),v=u+n);(bitxor(v,n)/u)>>2+v \\ Charles R Greathouse IV, Oct 28 2009
    
  • PARI
    A057168(n)=n+bitxor(n,n+n=bitand(n,-n))\n\4+n \\ M. F. Hasler, Aug 27 2014
    
  • Python
    def a(n): u = n&-n; v = u+n; return (((v^n)//u)>>2)+v
    print([a(n) for n in range(1, 72)]) # Michael S. Branicky, Jul 10 2022 after Charles R Greathouse IV
    
  • Python
    def A057168(n): return ((n&~(b:=n+(a:=n&-n)))>>a.bit_length())^b # Chai Wah Wu, Mar 06 2025

Formula

From Reinhard Zumkeller, Aug 18 2008: (Start)
a(A000079(n)) = A000079(n+1);
a(A000051(n)) = A052548(n);
a(A052548(n)) = A140504(n);
a(A000225(n)) = A055010(n);
a(A007283(n)) = A000051(n+2). (End)
a(n) = MIN{m: A000120(m)=A000120(n) and m>n}. - Reinhard Zumkeller, Aug 15 2009
For k,m>0, a((2^k-1)*2^m) = 2^(k+m)+2^(k-1)-1. - Chai Wah Wu, Mar 07 2025
If n is odd, then a(n) = XOR(n,OR(a,a/2)) where a = AND(-n,n+1). - Chai Wah Wu, Mar 08 2025

A038444 Sums of 2 distinct powers of 10.

Original entry on oeis.org

11, 101, 110, 1001, 1010, 1100, 10001, 10010, 10100, 11000, 100001, 100010, 100100, 101000, 110000, 1000001, 1000010, 1000100, 1001000, 1010000, 1100000, 10000001, 10000010, 10000100, 10001000, 10010000, 10100000, 11000000, 100000001, 100000010, 100000100
Offset: 1

Views

Author

Keywords

Crossrefs

Subsequence of A052216 and of A007088.
Cf. A018900.

Programs

  • Haskell
    a038444 n = a038444_list !! (n-1)
    a038444_list = 11 : f [11] 90 where
       f xs@(x:_) z = ys ++ f ys (10 * z) where
                      ys = (x + z) : map (* 10) xs
    -- Reinhard Zumkeller, Jan 28 2015
    
  • Maple
    seq(seq(10^d + 10^j, j=0..d-1), d=1..10); # Robert Israel, Oct 14 2016
  • Mathematica
    Sort[Total/@Subsets[10^Range[0,7],{2}]] (* Harvey P. Dale, Apr 20 2012 *)
  • PARI
    a(n)= 10^(n-1-binomial(sqrtint(n*8)\/2, 2)) + 10^((sqrtint(n*8)+1)\2); \\ Ruud H.G. van Tol, Nov 29 2024
    
  • Python
    from math import isqrt
    def A038444(n): return 10**(m:=isqrt(n<<3)+1>>1)+10**(n-1-(m*(m-1)>>1)) # Chai Wah Wu, Mar 11 2025

Formula

G.f.: (10*x - 55*x^2 + Sum_{d>=1} (4*10^d+5)*x^((d^2-d)/2+1) - Sum_{d>=1} (445*10^(d-1)+5)*x^((d^2-d)/2+2))/(5*(1-x)*(1-10*x)). - Robert Israel, Oct 14 2016

Extensions

Offset corrected by Reinhard Zumkeller, Jan 28 2015
Showing 1-10 of 77 results. Next