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

A265026 First differences of A048701.

Original entry on oeis.org

3, 6, 6, 18, 12, 6, 12, 66, 24, 12, 24, 6, 24, 12, 24, 258, 48, 24, 48, 12, 48, 24, 48, 6, 48, 24, 48, 12, 48, 24, 48, 1026, 96, 48, 96, 24, 96, 48, 96, 12, 96, 48, 96, 24, 96, 48, 96, 6, 96, 48, 96, 24, 96, 48, 96, 12, 96, 48, 96, 24, 96, 48
Offset: 1

Views

Author

N. J. A. Sloane, Nov 30 2015

Keywords

Comments

Comment from Altug Alkan, Dec 03 2015: (Start) Except for 3, all terms are divisible by 6 (cf. A048702, A265027).
Proof: Binary palindromes of even length (A048701) are odd for n > 0. So A048701(n) - A048701(n-1) is an even number for n > 1. Because the length is even and palindromic numbers are symmetric, for any digit “1” that is related with 2^n in its expansion which n is even, there are another digit “1” that is related with 2^m in its expansion which m is odd. 2^n+2^m is always divisible by 3 if n is even and m is odd. Therefore A048701(n) is divisible by 3, so A048701(n) - A048701(n-1) is divisible by 3 for n > 0. In conclusion, A048701(n) - A048701(n-1) is always divisible by 6 for n > 1. (End)

Crossrefs

Programs

  • PARI
    a048701(n) = my(f); f = length(binary(n)) - 1; 2^(f+1)*n + sum(i=0, f, bittest(n, i) * 2^(f-i));
    vector(100, n, (a048701(n) - a048701(n-1))) \\ Altug Alkan, Dec 03 2015

Formula

a(n) = A048701(n) - A048701(n-1). - Altug Alkan, Dec 03 2015

A265027 First differences of A048701 divided by 6.

Original entry on oeis.org

1, 1, 3, 2, 1, 2, 11, 4, 2, 4, 1, 4, 2, 4, 43, 8, 4, 8, 2, 8, 4, 8, 1, 8, 4, 8, 2, 8, 4, 8, 171, 16, 8, 16, 4, 16, 8, 16, 2, 16, 8, 16, 4, 16, 8, 16, 1, 16, 8, 16, 4, 16, 8, 16, 2, 16, 8, 16, 4, 16, 8, 16, 683, 32, 16, 32, 8, 32, 16, 32, 4, 32, 16, 32, 8, 32, 16, 32, 2, 32, 16, 32, 8, 32, 16, 32, 4, 32, 16, 32, 8
Offset: 2

Views

Author

N. J. A. Sloane, Nov 30 2015

Keywords

Comments

Indices n such that a(n) = 1 are equal to row sums of Lucas triangle. In other words, a(A042950(n)) = 1. Additionally, a(A070875(n)) = 2 and a(A123760(n)) = 4. - Altug Alkan, Dec 04 2015

Crossrefs

Programs

  • Mathematica
    Differences@ Select[Range@ 12000, Reverse@ # == # && EvenQ@ Length@ # &@ IntegerDigits[#, 2] &]/6 (* Michael De Vlieger, Dec 04 2015 *)
  • PARI
    a048701(n) = my(f); f = length(binary(n)) - 1; 2^(f+1)*n + sum(i=0, f, bittest(n, i) * 2^(f-i));
    vector(100, n, (a048701(n+1) - a048701(n)) / 6) \\ Altug Alkan, Dec 03 2015

Formula

a(n) = A265026(n) / 6, for n > 1. - Altug Alkan, Dec 03 2015

A000975 a(2n) = 2*a(2n-1), a(2n+1) = 2*a(2n)+1 (also a(n) is the n-th number without consecutive equal binary digits).

Original entry on oeis.org

0, 1, 2, 5, 10, 21, 42, 85, 170, 341, 682, 1365, 2730, 5461, 10922, 21845, 43690, 87381, 174762, 349525, 699050, 1398101, 2796202, 5592405, 11184810, 22369621, 44739242, 89478485, 178956970, 357913941, 715827882, 1431655765, 2863311530, 5726623061, 11453246122
Offset: 0

Views

Author

Keywords

Comments

Might be called the "Lichtenberg sequence" after Georg Christoph Lichtenberg, who discussed it in 1769 in connection with the Chinese Rings puzzle (baguenaudier). - Andreas M. Hinz, Feb 15 2017
Number of steps to change from a binary string of n 0's to n 1's using a Gray code. - Jon Stadler (jstadler(AT)coastal.edu)
Popular puzzles such as Spin-Out and The Brain Puzzler are based on the Gray binary system and require a(n) steps to complete for some number n.
Conjecture: {a(n)} also gives all j for which A048702(j) = A000217(j); i.e., if we take the a(n)-th triangular number (a(n)^2 + a(n))/2 and multiply it by 3, we get a(n)-th even-length binary palindrome A048701(a(n)) concatenated from a(n) and its reverse. E.g., a(4) = 10, which is 1010 in binary; the tenth triangular number is 55, and 55*3 = 165 = 10100101 in binary. - Antti Karttunen, circa 1999. (This has been now proved by Paul K. Stockmeyer in his arXiv:1608.08245 paper.) - Antti Karttunen, Aug 31 2016
Number of ways to tie a tie of n or fewer half turns, excluding mirror images. Also number of walks of length n or less on a triangular lattice with the following restrictions; given l, r and c as the lattice axes. 1. All steps are taken in the positive axis direction. 2. No two consecutive steps are taken on the same axis. 3. All walks begin with l. 4. All walks end with rlc or lrc. - Bill Blewett, Dec 21 2000
a(n) is the minimal number of vertices to be selected in a vertex-cover of the balanced tree B_n. - Sen-peng Eu, Jun 15 2002
A087117(a(n)) = A038374(a(n)) = 1 for n > 1; see also A090050. - Reinhard Zumkeller, Nov 20 2003
Intersection of A003754 and A003714; complement of A107907. - Reinhard Zumkeller, May 28 2005
Equivalently, numbers m whose binary representation is effectively, for some number k, both the lazy Fibonacci and the Zeckendorf representation of k (in which case k = A022290(m)). - Peter Munn, Oct 06 2022
a(n+1) gives row sums of Riordan array (1/(1-x), x(1+2x)). - Paul Barry, Jul 18 2005
Total number of initial 01's in all binary words of length n+1. Example: a(3) = 5 because the binary words of length 4 that start with 01 are (01)00, (01)(01), (01)10 and (01)11 and the total number of initial 01's is 5 (shown between parentheses). a(n) = Sum_{k >= 0} k*A119440(n+1, k). - Emeric Deutsch, May 19 2006
In Norway we call the 10-ring puzzle "strikketoy" or "knitwear" (see link). It takes 682 moves to free the two parts. - Hans Isdahl, Jan 07 2008
Equals A002450 and A020988 interlaced. - Zak Seidov, Feb 10 2008
For n > 1, let B_n = the complete binary tree with vertex set V where |V| = 2^n - 1. If VC is a minimum-size vertex cover of B_n, Sen-Peng Eu points out that a(n) = |VC|. It also follows that if IS = V\VC, a(n+1) = |IS|. - K.V.Iyer, Apr 13 2009
Starting with 1 and convolved with [1, 2, 2, 2, ...] = A000295. - Gary W. Adamson, Jun 02 2009
a(n) written in base 2 is sequence A056830(n). - Jaroslav Krizek, Aug 05 2009
This is the sequence A(0, 1; 1, 2; 1) of the family of sequences [a,b:c,d:k] considered by G. Detlefs, and treated as A(a,b;c,d;k) in the W. Lang link given below. - Wolfdieter Lang, Oct 18 2010
From Vladimir Shevelev, Jan 30 2012, Feb 13 2012: (Start)
1) Denote by {n, k} the number of permutations of 1, ..., n with the up-down index k (for definition, see comment in A203827). Then max_k{n, k} = {n, a(n)} = A000111(n).
2) a(n) is the minimal number > a(n-1) with the Hamming distance d_H(a(n-1), a(n)) = n. Thus this sequence is the Hamming analog of triangular numbers 0, 1, 3, 6, 10, ... (End)
From Hieronymus Fischer, Nov 22 2012: (Start)
Represented in binary form each term after the second one contains every previous term as a substring.
The terms a(2) = 2 and a(3) = 5 are the only primes. Proof: For even n we get a(n) = 2*(2^(2*n) - 1)/3, which shows that a(n) is even, too, and obviously a(n) > 2 for all even n > 2. For odd n we have a(n) = (2^(n+1) - 1)/3 = (2^((n+1)/2) - 1) * (2^((n+1)/2) + 1)/3. Evidently, at least one of these factors is divisible by 3, both are greater than 6, provided n > 3. Hence it follows that a(n) is composite for all odd n > 3.
Represented as a binary number, a(n+1) has exactly n prime substrings. Proof: Evidently, a(1) = 1_2 has zero and a(2) = 10_2 has 1 prime substring. Let n > 1. Written in binary, a(n+1) is 101010101...01 (if n + 1 is odd) and is 101010101...10 (if n + 1 is even) with n + 1 digits. Only the 2- and 3-digits substrings 10_2 (=2) and 101_2 (=5) are prime substrings. All the other substrings are nonprime since every substring is a previous term and all terms unequal to 2 and 5 are nonprime. For even n + 1, the number of prime substrings equal to 2 = 10_2 is (n+1)/2, and the number of prime substrings equal to 5 = 101_2 is (n-1)/2, makes a sum of n. For odd n + 1 we get n/2 for both, the number of 2's and 5's prime substrings, in any case, the sum is n. (End)
Number of different 3-colorings for the vertices of all triangulated planar polygons on a base with n+2 vertices if the colors of the two base vertices are fixed. - Patrick Labarque, Feb 09 2013
A090079(a(n)) = a(n) and A090079(m) <> a(n) for m < a(n). - Reinhard Zumkeller, Feb 16 2013
a(n) is the number of length n binary words containing at least one 1 and ending in an even number (possibly zero) of 0's. a(3) = 5 because we have: 001, 011, 100, 101, 111. - Geoffrey Critzer, Dec 15 2013
a(n) is the number of permutations of length n+1 having exactly one descent such that the first element of the permutation is an even number. - Ran Pan, Apr 18 2015
a(n) is the sequence of the last row of the Hadamard matrix H(2^n) obtained via Sylvester's construction: H(2) = [1,1;1,-1], H(2^n) = H(2^(n-1))*H(2), where * is the Kronecker product. - William P. Orrick, Jun 28 2015
Conjectured record values of A264784: a(n) = A264784(A155051(n-1)). - Reinhard Zumkeller, Dec 04 2015. (This is proved by Paul K. Stockmeyer in his arXiv:1608.08245 paper.) - Antti Karttunen, Aug 31 2016
Decimal representation of the x-axis, from the origin to the right edge, of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 131", based on the 5-celled von Neumann neighborhood. See A279053 for references and links. - Robert Price, Dec 05 2016
For n > 4, a(n-2) is the second-largest number in row n of A127824. - Dmitry Kamenetsky, Feb 11 2017
Conjecture: a(n+1) is the number of compositions of n with two kinds of parts, n and n', where the order of the 1 and 1' does not matter. For n=2, a(3) = 5 compositions, enumerated as follows: 2; 2'; 1,1; 1',1 = 1',1; 1',1'. - Gregory L. Simay, Sep 02 2017
Conjecture proved by recognizing the appropriate g.f. is x/(1 - x)(1 - x)(1 - 2*x^2 - 2x^3 - ...) = x/(1 - 2*x - x^2 + 2x^3). - Gregory L. Simay, Sep 10 2017
a(n) = 2^(n-1) + 2^(n-3) + 2^(n-5) + ... a(2*k -1) = A002450(k) is the sum of the powers of 4. a(2*k) = 2*A002450(k). - Gregory L. Simay, Sep 27 2017
a(2*n) = n times the string [10] in binary representation, a(2*n+1) = n times the string [10] followed with [1] in binary representation. Example: a(7) = 85 = (1010101) in binary, a(8) = 170 = (10101010) in binary. - Ctibor O. Zizka, Nov 06 2018
Except for 0, these are the positive integers whose binary expansion has cuts-resistance 1. For the operation of shortening all runs by 1, cuts-resistance is the number of applications required to reach an empty word. Cuts-resistance 2 is A329862. - Gus Wiseman, Nov 27 2019
From Markus Sigg, Sep 14 2020: (Start)
Let s(k) be the length of the Collatz orbit of k, e.g. s(1) = 1, s(2) = 2, s(3) = 5. Then s(a(n)) = n+3 for n >= 3. Proof by induction: s(a(3)) = s(5) = 6 = 3+3. For odd n >= 5 we have s(a(n)) = s(4*a(n-2)+1) = s(12*a(n-2)+4)+1 = s(3*a(n-2)+1)+3 = s(a(n-2))+2 = (n-2)+3+2 = n+3, and for even n >= 4 this gives s(a(n)) = s(2*a(n-1)) = s(a(n-1))+1 = (n-1)+3+1 = n+3.
Conjecture: For n >= 3, a(n) is the second largest natural number whose Collatz orbit has length n+3. (End)
From Gary W. Adamson, May 14 2021: (Start)
With offset 1 the sequence equals the numbers of 1's from n = 1 to 3, 3 to 7, 7 to 15, ...; of A035263; as shown below:
..1 3 7 15...
..1 0 1 1 1 0 1 0 1 0 1 1 1 0 1...
..1.....2...........5......................10...; a(n) = Sum_(k=1..2n-1)A035263(k)
.....1...........2.......................5...; as to zeros.
..1's in the Tower of Hanoi game represent CW moves On disks in the pattern:
..0, 1, 2, 0, 1, 2, ... whereas even numbered disks move in the pattern:
..0, 2, 1, 0, 2, 1, ... (End)
Except for 0, numbers that are repunits in Gray-code representation (A014550). - Amiram Eldar, May 21 2021
From Gus Wiseman, Apr 20 2023: (Start)
Also the number of nonempty subsets of {1..n} with integer median, where the median of a multiset is the middle part in the odd-length case, and the average of the two middle parts in the even-length case. For example, the a(1) = 1 through a(4) = 10 subsets are:
{1} {1} {1} {1}
{2} {2} {2}
{3} {3}
{1,3} {4}
{1,2,3} {1,3}
{2,4}
{1,2,3}
{1,2,4}
{1,3,4}
{2,3,4}
The complement is counted by A005578.
For mean instead of median we have A051293, counting empty sets A327475.
For normal multisets we have A056450, strongly normal A361202.
For partitions we have A325347, strict A359907, complement A307683.
(End)

Examples

			a(4)=10 since 0001, 0011, 0010, 0110, 0111, 0101, 0100, 1100, 1101, 1111 are the 10 binary strings switching 0000 to 1111.
a(3) = 1 because "lrc" is the only way to tie a tie with 3 half turns, namely, pass the business end of the tie behind the standing part to the left, bring across the front to the right, then behind to the center. The final motion of tucking the loose end down the front behind the "lr" piece is not considered a "step".
a(4) = 2 because "lrlc" is the only way to tie a tie with 4 half turns. Note that since the number of moves is even, the first step is to go to the left in front of the tie, not behind it. This knot is the standard "four in hand", the most commonly known men's tie knot. By contrast, the second most well known tie knot, the Windsor, is represented by "lcrlcrlc".
a(n) = (2^0 - 1) XOR (2^1 - 1) XOR (2^2 - 1) XOR (2^3 - 1) XOR ... XOR (2^n - 1). - _Paul D. Hanna_, Nov 05 2011
G.f. = x + 2*x^2 + 5*x^3 + 10*x^4 + 21*x^5 + 42*x^6 + 85*x^7 + 170*x^8 + ...
a(9) = 341 = 2^8 + 2^6 + 2^4 + 2^2 + 2^0 = 4^4 + 4^3 + 4^2 + 4^1 + 4^0 = A002450(5). a(10) = 682 = 2*a(9) = 2*A002450(5). - _Gregory L. Simay_, Sep 27 2017
		

References

  • Thomas Fink and Yong Mao, The 85 Ways to Tie a Tie, Broadway Books, New York (1999), p. 138.
  • Clifford A. Pickover, The Math Book, From Pythagoras to the 57th Dimension, 250 Milestones in the History of Mathematics, Sterling Publ., NY, 2009.

Crossrefs

Partial sums of A001045.
Row sums of triangle A013580.
Equals A026644/2.
Union of the bijections A002450 and A020988. - Robert G. Wilson v, Jun 09 2014
Column k=3 of A261139.
Complement of A107907.
Row 3 of A300653.
Other sequences that relate to the binary representation of the terms: A003714, A003754, A007088, A022290, A056830, A104161, A107909.

Programs

  • GAP
    List([0..35],n->(2^(n+1)-2+(n mod 2))/3); # Muniru A Asiru, Nov 01 2018
    
  • Haskell
    a000975 n = a000975_list !! n
    a000975_list = 0 : 1 : map (+ 1)
       (zipWith (+) (tail a000975_list) (map (* 2) a000975_list))
    -- Reinhard Zumkeller, Mar 07 2012
    
  • Magma
    [(2^(n+1) - 2 + (n mod 2))/3: n in [0..40]]; // Vincenzo Librandi, Mar 18 2015
    
  • Maple
    A000975 := proc(n) option remember; if n <= 1 then n else if n mod 2 = 0 then 2*A000975(n-1) else 2*A000975(n-1)+1 fi; fi; end;
    seq(iquo(2^n,3),n=1..33); # Zerinvary Lajos, Apr 20 2008
    f:=n-> if n mod 2 = 0 then (2^n-1)/3 else (2^n-2)/3; fi; [seq(f(n),n=0..40)]; # N. J. A. Sloane, Mar 21 2017
  • Mathematica
    Array[Ceiling[2(2^# - 1)/3] &, 41, 0]
    RecurrenceTable[{a[0] == 0, a[1] == 1, a[n] == a[n - 1] + 2a[n - 2] + 1}, a, {n, 40}] (* or *)
    LinearRecurrence[{2, 1, -2}, {0, 1, 2}, 40] (* Harvey P. Dale, Aug 10 2013 *)
    f[n_] := Block[{exp = n - 2}, Sum[2^i, {i, exp, 0, -2}]]; Array[f, 33] (* Robert G. Wilson v, Oct 30 2015 *)
    f[s_List] := Block[{a = s[[-1]]}, Append[s, If[OddQ@ Length@ s, 2a + 1, 2a]]]; Nest[f, {0}, 32] (* Robert G. Wilson v, Jul 20 2017 *)
    NestList[2# + Boole[EvenQ[#]] &, 0, 39] (* Alonso del Arte, Sep 21 2018 *)
  • PARI
    {a(n) = if( n<0, 0, 2 * 2^n \ 3)}; /* Michael Somos, Sep 04 2006 */
    
  • PARI
    a(n)=if(n<=0,0,bitxor(a(n-1),2^n-1)) \\ Paul D. Hanna, Nov 05 2011
    
  • PARI
    concat(0, Vec(x/(1-2*x-x^2+2*x^3) + O(x^100))) \\ Altug Alkan, Oct 30 2015
    
  • PARI
    {a(n) = (4*2^n - 3 - (-1)^n) / 6}; /* Michael Somos, Jul 23 2017 */
    
  • Python
    def a(n): return (2**(n+1) - 2 + (n%2))//3
    print([a(n) for n in range(35)]) # Michael S. Branicky, Dec 19 2021

Formula

a(n) = ceiling(2*(2^n-1)/3).
Alternating sum transform (PSumSIGN) of {2^n - 1} (A000225).
a(n) = a(n-1) + 2*a(n-2) + 1.
a(n) = 2*2^n/3 - 1/2 - (-1)^n/6.
a(n) = Sum_{i = 0..n} A001045(i), partial sums of A001045. - Bill Blewett
a(n) = n + 2*Sum_{k = 1..n-2} a(k).
G.f.: x/((1+x)*(1-x)*(1-2*x)) = x/(1-2*x-x^2+2*x^3). - Paul Barry, Feb 11 2003
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3). - Paul Barry, Feb 11 2003
a(n) = Sum_{k = 0..floor((n-1)/2)} 2^(n-2*k-1). - Paul Barry, Nov 11 2003
a(n+1) = Sum_{k=0..floor(n/2)} 2^(n-2*k); a(n+1) = Sum_{k = 0..n} Sum_{j = 0..k} (-1)^(j+k)*2^j. - Paul Barry, Nov 12 2003
(-1)^(n+1)*a(n) = Sum_{i = 0..n} Sum_{k = 1..i} k!*k* Stirling2(i, k)*(-1)^(k-1) = (1/3)*(-2)^(n+1)-(1/6)(3*(-1)^(n+1)-1). - Mario Catalani (mario.catalani(AT)unito.it), Dec 22 2003
a(n+1) = (n!/3)*Sum_{i - (-1)^i + j = n, i = 0..n, j = 0..n} 1/(i - (-1)^i)!/j!. - Benoit Cloitre, May 24 2004
a(n) = A001045(n+1) - A059841(n). - Paul Barry, Jul 22 2004
a(n) = Sum_{k = 0..n} 2^(n-k-1)*(1-(-1)^k), row sums of A130125. - Paul Barry, Jul 28 2004
a(n) = Sum_{k = 0..n} binomial(k, n-k+1)2^(n-k); a(n) = Sum_{k = 0..floor(n/2)} binomial(n-k, k+1)2^k. - Paul Barry, Oct 07 2004
a(n) = A107909(A104161(n)); A007088(a(n)) = A056830(n). - Reinhard Zumkeller, May 28 2005
a(n) = floor(2^(n+1)/3) = ceiling(2^(n+1)/3) - 1 = A005578(n+1) - 1. - Paul Barry, Oct 08 2005
Convolution of "Number of fixed points in all 231-avoiding involutions in S_n." (A059570) with "1-n" (A024000), treating the result as if offset was 0. - Graeme McRae, Jul 12 2006
a(n) = A081254(n) - 2^n. - Philippe Deléham, Oct 15 2006
Starting (1, 2, 5, 10, 21, 42, ...), these are the row sums of triangle A135228. - Gary W. Adamson, Nov 23 2007
Let T = the 3 X 3 matrix [1,1,0; 1,0,1; 0,1,1]. Then T^n * [1,0,0] = [A005578(n), A001045(n), a(n-1)]. - Gary W. Adamson, Dec 25 2007
2^n = 2*A005578(n-1) + 2*A001045(n) + 2*a(n-2). - Gary W. Adamson, Dec 25 2007
If we define f(m,j,x) = Sum_{k=j..m} binomial(m,k)*stirling2(k,j)*x^(m-k) then a(n-3) = (-1)^(n-1)*f(n,3,-2), (n >= 3). - Milan Janjic, Apr 26 2009
a(n) + A001045(n) = A166920(n). a(n) + A001045(n+2) = A051049(n+1). - Paul Curtz, Oct 29 2009
a(n) = floor(A051049(n+1)/3). - Gary Detlefs, Dec 19 2010
a(n) = round((2^(n+2)-3)/6) = floor((2^(n+1)-1)/3) = round((2^(n+1)-2)/3); a(n) = a(n-2) + 2^(n-1), n > 1. - Mircea Merca, Dec 27 2010
a(n) = binary XOR of 2^k-1 for k=0..n. - Paul D. Hanna, Nov 05 2011
E.g.f.: 2/3*exp(2*x) - 1/2*exp(x) - 1/6*exp(-x) = 2/3*U(0); U(k) = 1 - 3/(4*(2^k) - 4*(2^k)/(1+3*(-1)^k - 24*x*(2^k)/(8*x*(2^k)*(-1)^k - (k+1)/U(k+1)))); (continued fraction). - Sergei N. Gladkovskii, Nov 21 2011
Starting with "1" = triangle A059260 * [1, 2, 2, 2, ...] as a vector. - Gary W. Adamson, Mar 06 2012
a(n) = 2*(2^n - 1)/3, for even n; a(n) = (2^(n+1) - 1)/3 = (1/3)*(2^((n+1)/2) - 1)*(2^((n+1)/2) + 1), for odd n. - Hieronymus Fischer, Nov 22 2012
a(n) + a(n+1) = 2^(n+1) - 1. - Arie Bos, Apr 03 2013
G.f.: Q(0)/(3*(1-x)), where Q(k) = 1 - 1/(4^k - 2*x*16^k/(2*x*4^k - 1/(1 + 1/(2*4^k - 8*x*16^k/(4*x*4^k + 1/Q(k+1)))))); (continued fraction). - Sergei N. Gladkovskii, May 21 2013
floor(a(n+2)*3/5) = A077854(n), for n >= 0. - Armands Strazds, Sep 21 2014
a(n) = (2^(n+1) - 2 + (n mod 2))/3. - Paul Toms, Mar 18 2015
a(0) = 0, a(n) = 2*(a(n-1)) + (n mod 2). - Paul Toms, Mar 18 2015
Binary: a(n) = (a(n-1) shift left 1) + (a(n-1)) NOR (...11110). - Paul Toms, Mar 18 2015
Binary: for n > 1, a(n) = 2*a(n-1) OR a(n-2). - Stanislav Sykora, Nov 12 2015
a(n) = A266613(n) - 20*2^(n-5), for n > 2. - Andres Cicuttin, Mar 31 2016
From Michael Somos, Jul 23 2017: (Start)
a(n) = -(2^n)*a(-n) for even n; a(n) = -(2^(n+1))*a(-n) + 1 for odd n.
0 = +a(n)*(+2 +4*a(n) -4*a(n+1)) + a(n+1)*(-1 +a(n+1)) for all n in Z. (End)
G.f.: (x^1+x^3+x^5+x^7+...)/(1-2*x). - Gregory L. Simay, Sep 27 2017
a(n+1) = A051049(n) + A001045(n). - Yuchun Ji, Jul 12 2018
a(n) = A153772(n+3)/4. - Markus Sigg, Sep 14 2020
a(4*k+d) = 2^(d+1)*a(4*k-1) + a(d), a(n+4) = a(n) + 2^n*10, a(0..3) = [0,1,2,5]. So the last digit is always 0,1,2,5 repeated. - Yuchun Ji, May 22 2023

Extensions

Additional comments from Barry E. Williams, Jan 10 2000

A006995 Binary palindromes: numbers whose binary expansion is palindromic.

Original entry on oeis.org

0, 1, 3, 5, 7, 9, 15, 17, 21, 27, 31, 33, 45, 51, 63, 65, 73, 85, 93, 99, 107, 119, 127, 129, 153, 165, 189, 195, 219, 231, 255, 257, 273, 297, 313, 325, 341, 365, 381, 387, 403, 427, 443, 455, 471, 495, 511, 513, 561, 585, 633, 645, 693, 717, 765, 771, 819, 843
Offset: 1

Views

Author

Keywords

Comments

If b > 1 is a binary palindrome then both (2^(m+1) + 1)*b and 2^(m+1) + 2^m - b are also, where m = floor(log_2(b)). - Hieronymus Fischer, Feb 18 2012
Floor and ceiling: If d > 0 is any natural number, then A206913(d) is the greatest binary palindrome <= d and A206914(d) is the least binary palindrome >= d. - Hieronymus Fischer, Feb 18 2012
The greatest binary palindrome <= the n-th non-binary-palindrome is that binary palindrome with number A154809(n)-n+1. The corresponding formula identity is: A206913(A154809(n)) = A006995(A154809(n)-n+1). - Hieronymus Fischer, Mar 18 2012
From Hieronymus Fischer, Jan 23 2013: (Start)
The number of binary digits of a(n) is A070939(a(n)) = 1 + floor(log_2(n)) + floor(log_2(n/3)), for n > 1.
Also: A070939(a(n)) = A070939(n) + A070939(floor(n/3)) - 1, for n <> 2. (End)
Rajasekaran, Shallit, & Smith show that this is an additive basis of order 4. - Charles R Greathouse IV, Nov 06 2018

Examples

			a(3) = 3, since 3 = 11_2 is the 3rd symmetric binary number;
a(6) = 9, since 9 = 1001_2 is the 6th symmetric binary number.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A057148 for the binary representations.
Cf. A178225, A005408, A164126, A154809 (complement).
Even numbers that are not the sum of two terms: A241491, A261678, A262556.
Cf. A145799.
Primes: A016041 and A117697.
Cf. A000051 (a subsequence).

Programs

  • Haskell
    a006995 n = a006995_list !! (n-1)
    a006995_list = 0 : filter ((== 1) . a178225) a005408_list
    -- Reinhard Zumkeller, Oct 21 2011
    
  • Magma
    [n: n in [0..850] | Intseq(n,2) eq Reverse(Intseq(n,2))];  // Bruno Berselli, Aug 29 2011
    
  • Maple
    dmax:= 15; # to get all terms with at most dmax binary digits
    revdigs:= proc(n)
      local L, Ln, i;
      L:= convert(n,base,2);
      Ln:= nops(L);
      add(L[i]*2^(Ln-i),i=1..Ln);
    end proc;
    A:= {0,1}:
    for d from 2 to dmax do
      if d::even then
        A:= A union {seq(2^(d/2)*x + revdigs(x),x=2^(d/2-1)..2^(d/2)-1)}
      else
        m:= (d-1)/2;
        B:={seq(2^(m+1)*x + revdigs(x),x=2^(m-1)..2^m-1)};
        A:= A union B union map(`+`,B,2^m)
      fi
    od:
    A;  # Robert Israel, Aug 17 2014
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn=IntegerDigits[n, base]}, idn==Reverse[idn]]; Select[Range[1000], palQ[ #, 2]&]
    Select[ Range[0, 1000], # == IntegerReverse[#, 2] &] (* Robert G. Wilson v, Feb 24 2018 *)
    Select[Range[0, 1000], PalindromeQ[IntegerDigits[#, 2]]&] (* Jean-François Alcover, Mar 01 2018 *)
  • PARI
    for(n=0,999,n-subst(Polrev(binary(n)),x,2)||print1(n,",")) \\ Thomas Buchholz, Aug 16 2014
    
  • PARI
    for(n=0,10^3, my(d=digits(n,2)); if(d==Vecrev(d), print1(n,", "))); \\ Joerg Arndt, Aug 17 2014
    
  • PARI
    is_A006995(n)=Vecrev(n=binary(n))==n \\ M. F. Hasler, Feb 23 2018
    
  • PARI
    A006995(n,m=logint(n,2),c=1<<(m-1),a,d)={if(n>=3*c,a=n-3*c;d=2*c^2,a=n-2*c;n%2*c+d=c^2)+sum(k=1,m-2^(n<3*c),if(bittest(a,m-1-k),1<>k))+(n>2)} \\ Based on Fischer's smalltalk program. - M. F. Hasler, Feb 23 2018
    
  • Python
    from itertools import count, islice, product
    def bin_pals(): # generator of binary palindromes in base 10
        yield from [0, 1]
        digits, midrange = 2, [[""], ["0", "1"]]
        for digits in count(2):
            for p in product("01", repeat=digits//2-1):
                left = "1"+"".join(p)
                for middle in midrange[digits%2]:
                    yield int(left + middle + left[::-1], 2)
    print(list(islice(bin_pals(), 58))) # Michael S. Branicky, Jan 09 2023
    
  • Python
    def A006995(n):
        if n == 1: return 0
        a = 1<<(l:=n.bit_length()-2)
        m = a|(n&a-1)
        return (m<Chai Wah Wu, Jun 10 2024
  • Sage
    def palgenbase2(): # generator of palindromes in base 2
        yield 0
        x, n, n2 = 1, 1, 2
        while True:
            for y in range(n,n2):
                s = format(y,'b')
                yield int(s+s[-2::-1],2)
            for y in range(n,n2):
                s = format(y,'b')
                yield int(s+s[::-1],2)
            x += 1
            n *= 2
            n2 *= 2 # Chai Wah Wu, Jan 07 2015
    
  • Sage
    [n for n in (0..843) if Word(n.digits(2)).is_palindrome()] # Peter Luschny, Sep 13 2018
    
  • Smalltalk
    A006995
    "Answer the n-th binary palindrome
    (nonrecursive implementation)"
    | m n a b c d k2 |
    n := self.
    n = 1 ifTrue: [^0].
    n = 2 ifTrue: [^1].
    m := n integerFloorLog: 2.
    c := 2 raisedToInteger: m - 1.
    n >= (3 * c)
      ifTrue:
       [a := n - (3 * c).
       d := 2 * c * c.
       b := d + 1.
       k2 := 1.
       1 to: m - 1
        do:
         [:k |
         k2 := 2 * k2.
         b := b + (a * k2 // c \\ 2 * (k2 + (d // k2)))]]
      ifFalse:
       [a := n - (2 * c).
       d := c * c.
       b := d + 1 + (n \\ 2 * c).
       k2 := 1.
       1 to: m - 2
        do:
         [:k |
         k2 := 2 * k2.
         b := b + (a * k2 // c \\ 2 * (k2 + (d // k2)))]].
    ^b // by Hieronymus Fischer, Feb 15 2013
    

Formula

A178225(a(n)) = 1; union of A048700 and A048701. - Reinhard Zumkeller, Oct 21 2011
From Hieronymus Fischer, Dec 31 2008, Jan 10 2012, Feb 18 2012: (Start)
Written as a decimal, a(10^n) has 2*n digits. For n > 1, the decimal expansion of a(10^n) starts with 22..., 23... or 24...:
a(1000) = 249903,
a(10^4) = 24183069,
a(10^5) = 2258634081,
a(10^6) = 249410097687,
a(10^7) = 24350854001805,
a(10^8) = 2229543293296319,
a(10^9) = 248640535848971067,
a(10^10)= 24502928886295666773.
Inequality: (2/9)*n^2 < a(n) < (1/4)*(n+1)^2, if n > 1.
lim sup_{n -> oo} a(n)/n^2 = 1/4, lim inf_{n -> oo} a(n)/n^2 = 2/9.
For n >= 2, a(2^n-1) = 2^(2n-2) - 1; a(2^n) = 2^(2n-2) + 1;
a(2^n+1) = 2^(2n-2) + 2^(n-1) + 1; a(2^n + 2^(n-1)) = 2^(2n-1) + 1.
Recursion for n > 2: a(n) = 2^(2k-q) + 1 + 2^p*a(m), where k = floor(log_2(n-1)), and p, q and m are determined as follows:
Case 1: If n = 2^(k+1), then p = 0, q = 0, m = 1;
Case 2: If 2^k < n < 2^k+2^(k-1), then p = k-floor(log_2(i))-1 with i = n-2^k, q = 2, m = 2^floor(log_2(i)) + i;
Case 3: If n = 2^k + 2^(k-1), then p = 0, q = 1, m = 1;
Case 4: If 2^k + 2^(k-1) < n < 2^(k+1), then p = k-floor(log_2(j))-1 with j = n-2^k-2^(k-1), q = 1, m = 2*2^floor(log_2(j))+j.
Non-recursive formula:
Let n >= 3, m = floor(log_2(n)), p = floor((3*2^(m-1)-1)/n), then
a(n) = 2^(2*m-1-p) + 1 + p*(1-(-1)^n)*2^(m-1-p) + sum_{k=1 .. m-1-p} (floor((n-(3-p)*2^(m-1))/2^(m-1-k)) mod 2)*(2^k+2^(2*m-1-p-k)). [Typo at the last exponent of the third sum term eliminated by the author, Sep 05 2018]
a(n) = 2^(2*m-2) + 1 + 2*floor((n-2^m)/2^(m-1)) + 2^(m-1)*floor((1/2)*min(n+1-2^m,2^(m-1)+1)) + 3*2^(m-1)*floor((1/2)*max(n+1-3*2^(m-1),0)) + 3*sum_{j=2 .. m-1} floor((n+2^(j-1)-2^m)/2^j)*2^(m-j). [Seems correct for n > 3. - The Editors]
Inversion formula: The index of any binary palindrome b = a(n) > 0 is n = palindromicIndex(b) = ((5-(-1)^m)/2 + Sum_{k=1..[m/2]} ([b/2^k] mod 2)/2^k)*2^[m/2], where [.] = floor(.) and m = [log_2(b)].
(End)
G.f.: g(x) = x^2 + 3x^3 + sum_{j=1..oo}( 3*2^j*(1-x^floor((j+1)/2))/(1-x)*x^((1/2)-floor((j+1)/2)) + f_j(x) - f_j(1/x))*x^(2*2^floor(j/2)+3*2^floor((j-1)/2)-(1/2)), where the f_j(x) are defined as follows:
f_1(x) = x^(1/2), and for j > 1,
f_j(x) = x^(1/2)*sum_{i=0..2^floor((j-1)/2)-1}((3+(1/2)*sum_{k=1..floor((j-1)/2)}(1-(-1)^floor(2i/2^k))*b(j,k))*x^i), where b(j,k) = 2^(floor((j-1)/2)-k)*((3+(-1)^j)*2^(2*k+1)+4) for k > 1, and b(j,1) = (2+(-1)^j)*2^(floor((j-1)/2)+1). - Hieronymus Fischer, Apr 04 2012
A044051(n) = (a(n)+1)/2 for n > 0. - Reinhard Zumkeller, Apr 20 2015
A145799(a(n)) = a(n). - Reinhard Zumkeller, Sep 24 2015
Sum_{n>=2} 1/a(n) = A244162. - Amiram Eldar, Oct 17 2020

Extensions

Edited and extended by Hieronymus Fischer, Feb 21 2012
Edited by M. F. Hasler, Feb 23 2018

A048700 Binary palindromes of odd length (written in base 10).

Original entry on oeis.org

1, 5, 7, 17, 21, 27, 31, 65, 73, 85, 93, 99, 107, 119, 127, 257, 273, 297, 313, 325, 341, 365, 381, 387, 403, 427, 443, 455, 471, 495, 511, 1025, 1057, 1105, 1137, 1161, 1193, 1241, 1273, 1285, 1317, 1365, 1397, 1421, 1453, 1501, 1533, 1539, 1571, 1619, 1651
Offset: 1

Views

Author

Antti Karttunen, Mar 07 1999

Keywords

Comments

Note: you get A006995 (all binary palindromes) if you take (after zero) alternatively 2^n (starting from 2^0 = 1) terms from A048700 and as many from A048701 and then each time, twice as many from both.
A178225(a(n)) = 1. - Reinhard Zumkeller, Oct 21 2011
Comment from Altug Alkan, Dec 03 2015: (Start)
a(6*k) is divisible by 9 for k > 0.
a(3*k+(-1)^k-2) is divisible by 3 for k > 1.
The minimum value of a(n+1) - a(n) occurs when n = 2.
A014551(n) appears in this sequence for n > 0. (End)

Crossrefs

Cf. A048701 (binary palindromes of even length), A002113 (decimal palindromes), A006995 (all binary palindromes).
Cf. also A178225.

Programs

  • Haskell
    import Data.Set (singleton, deleteFindMin, insert)
    import Data.List (unfoldr)
    a048700 n = a048700_list !! (n-1)
    a048700_list = f 1 $ singleton 1 where
       f z s = m : f (z+1) (insert (c 0) (insert (c 1) s')) where
         c d = foldl (\v d -> 2 * v + d) 0 $ (reverse b) ++ [d] ++ b
         b = unfoldr
             (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2) z
         (m,s') = deleteFindMin s
    -- Reinhard Zumkeller, Oct 21 2011
    
  • Maple
    bit_i := (x,i) -> `mod`(floor(x/(2^i)),2);
    floor_log_2 := proc(n) local nn,i: nn := n; for i from -1 to n do if(0 = nn) then RETURN(i); fi: nn := floor(nn/2); od: end:
  • Mathematica
    Select[Range@ 1651, # == Reverse@ # && OddQ@ Length@ # &@ IntegerDigits[#, 2] &] (* Michael De Vlieger, Dec 03 2015 *)
  • PARI
    {a(n) = local(f); if( n<1, 0, f = length(binary(n)) - 1; 2^f*n + sum(i=1, f, bittest(n,i) * 2^(f-i)))}; /* Michael Somos, Nov 27 2002 */
    
  • Python
    def A048700(n):
        s = bin(n)[2:]
        return int(s+s[-2::-1],2) # Chai Wah Wu, Feb 26 2021

Formula

a(n) = (2^(floor_log_2(n)))*n + sum('(bit_i(n, i)*(2^(floor_log_2(n)-i)))', 'i'=1..floor_log_2(n));
a(A047264(n)) mod 3 = 0, for n > 1. - Altug Alkan, Dec 03 2015

A048702 Binary palindromes of even length divided by 3.

Original entry on oeis.org

0, 1, 3, 5, 11, 15, 17, 21, 43, 51, 55, 63, 65, 73, 77, 85, 171, 187, 195, 211, 215, 231, 239, 255, 257, 273, 281, 297, 301, 317, 325, 341, 683, 715, 731, 763, 771, 803, 819, 851, 855, 887, 903, 935, 943, 975, 991
Offset: 0

Views

Author

Antti Karttunen, Mar 07 1999

Keywords

Comments

Let the length of A048701(n) in binary be 2k. Since it is a palindrome of even length, its digits come in pairs which are equal: one in the left half and the other in the right half. Thus, A048701(n) is a sum of numbers of the form d * 2^m * (2^(2k-2m-1) + 1). The number 2^(2k-2m-1) = 2 * 4^(k-m-1) is congruent to 2 (mod 3), so 2^(2k-2m-1) + 1 is divisible by 3. This means A048701(n) is divisible by 3, and therefore a(n) is an integer. - Michael B. Porter, Jun 18 2019

Crossrefs

Cf. A048701, A048704 (base 4 palindromes of even length divided by 5), A044051 (binary palindromes plus one divided by 2: (A006995(n)+1)/2), A000975.

Programs

  • Maple
    # Two unproved formulas which are not based upon first generating a palindrome and then dividing by 3, recursive and more direct:
    # Here d is 2^(the distance between the most and least significant 1-bit of n):
    bper3_rec := proc(n) option remember; local d; if(0 = n) then RETURN(0); fi; d := 2^([ log2(n) ]-A007814[ n ]);
    if(1 = d) then RETURN((2*bper3_rec(n-1))+d); else RETURN(bper3_rec(n-1)+d); fi; end;
    # or more directly (after K. Atanassov's formula for partial sums of A007814):
    bper3_direct := proc(n) local l,j; l := [ log2(n) ]; RETURN((2/3*((2^(2*l))-1))+1+ sum('(2^(l-j)*floor((n-(2^l)+2^j)/(2^(j+1))))','j'=0..l)); end;
    # Can anybody find an even simpler closed form? See A005187 for inspiration.
  • Mathematica
    Join[{0}, Reap[For[k = 1, k < 3000, k += 2, bb = IntegerDigits[k, 2]; If[bb == Reverse[bb], If[EvenQ[Length[bb]], Sow[k/3]]]]][[2, 1]]] (* Jean-François Alcover, Mar 04 2016 *)

Formula

a(n) = A048701(n)/3.
Conjecture: a(n) = 2^floor(log_2(n)) * Sum_{i=1..n} 1/(2^v_2(i)), for n >= 1, where v_2(i) = A007814(i) is the exponent of the highest power of 2 dividing i.
Conjecture: a(n) = n*2^floor(log_2(n)) - Sum_{i=1..floor(log_2(n))} 2^(floor(log_2(n)) - i)*floor(n/(2^i)).

A075113 a(n) = A000217(n) - A048702(n).

Original entry on oeis.org

0, 0, 0, 1, -1, 0, 4, 7, -7, -6, 0, 3, 13, 18, 28, 35, -35, -34, -24, -21, -5, 0, 14, 21, 43, 52, 70, 81, 105, 118, 140, 155, -155, -154, -136, -133, -105, -100, -78, -71, -35, -26, 0, 11, 47, 60, 90, 105, 151, 168, 202, 221, 265, 286, 324, 347, 399, 424, 466, 493, 545, 574, 620, 651, -651, -650, -616, -613, -561
Offset: 0

Views

Author

Antti Karttunen, Sep 02 2002

Keywords

Comments

The positions of the zeros seem to be given by A000975.

Crossrefs

Programs

  • Mathematica
    A048702 := Join[{0}, Reap[For[k = 1, k < 1500, k += 2, bb = IntegerDigits[k, 2]; If[bb == Reverse[bb], If[EvenQ[Length[bb]], Sow[k/3]]]]][[2, 1]]]; Table[n*(n + 1)/2 - A048702[[n + 1]], {n, 0, 50}] (* G. C. Greubel, Sep 26 2017 *)
  • PARI
    a01(n) = my(f); f = length(binary(n)) - 1; 2^(f+1)*n + sum(i=0, f, bittest(n, i) * 2^(f-i)); \\ A048701
    a(n) = n*(n+1)/2 - a01(n)/3; \\ A006095
    
  • Python
    def A075113(n: int) -> int:
        s = bin(n)[2:]
        return n * (n + 1) // 2 - int(s + s[::-1], 2) // 3
    print([A075113(n) for n in range(69)]) # Peter Luschny, Dec 14 2022

Formula

a(A000225(n)) = ((2^n)-1)*(2^(n-1)) - (2^(2n) - 1)/3 = A006095(n).

Extensions

Definition corrected by Georg Fischer, Dec 13 2022

A048703 Numbers which in base 4 are palindromes and have an even number of digits.

Original entry on oeis.org

0, 5, 10, 15, 65, 85, 105, 125, 130, 150, 170, 190, 195, 215, 235, 255, 1025, 1105, 1185, 1265, 1285, 1365, 1445, 1525, 1545, 1625, 1705, 1785, 1805, 1885, 1965, 2045, 2050, 2130, 2210, 2290, 2310, 2390
Offset: 0

Views

Author

Antti Karttunen, Mar 07 1999

Keywords

Comments

In quaternary base (base 4) the terms look like 0, 11, 22, 33, 1001, 1111, 1221, 1331, 2002, 2112, 2222, 2332, 3003, 3113, 3223, 3333, 100001, 101101, 102201, ..., which is a subsequence of A118595.
Zero is included as a(0) because we can consider it as having zero digits after leading zeros have been excluded.

Examples

			Each a(n) is obtained by concatenating the original base-4 expansion of n (which comes to the left hand, i.e., the most significant side) with its mirror-image (which comes to the right hand, i.e., the least significant side). For example, for a(4) we have 4 = '10' in base 4, which concatenated with its reversal '01' yields '1001', which when converted back to decimal yields 1*64 + 0*16 + 0*4 + 1*1 = 65, thus a(4)=65.
		

Crossrefs

Subsequence of A014192 (all numbers which are palindromes in base 4, including also those of odd number of digits).
Cf. also A048704 (this sequence divided by 5), A048701 (binary palindromes of even length), A055948, A110591, A118595, A030103, A007090, A000302.

Programs

  • Maple
    A048703(n) := (n) -> (2^(floor_log_2_coarse(n)+1))*n + sum('(bit_i(n, i+((-1)^i))*(2^(floor_log_2_coarse(n)-i)))', 'i'=0..floor_log_2_coarse(n));
    bit_i := (x,i) -> `mod`(floor(x/(2^i)),2);
    # Following is like floor_log_2 but even results are incremented by one:
    floor_log_2_coarse := proc(n) local nn,i: nn := n; for i from -1 to n do if(0 = nn) then RETURN(i+(1-(i mod 2))); fi: nn := floor(nn/2); od: end:
  • Mathematica
    q[n_] := EvenQ[IntegerLength[n, 4]] && PalindromeQ[IntegerDigits[n, 4]]; Select[Range[0, 2400, 5], q] (* Amiram Eldar, May 27 2024 *)
  • Python
    def A048703(n):
        s = bin(n-1)[2:]
        if len(s) % 2: s = '0'+s
        t = [s[i:i+2] for i in range(0,len(s),2)]
        return int(''.join(t+t[::-1]),2) # Chai Wah Wu, Feb 26 2021

Formula

a(0) = 0, and for n >= 1, a(n) = A030103(n) + (n * A000302(A110591(n))). - Antti Karttunen, Oct 30 2013
a(n) = 5*A048704(n). [This is just a consequence of the definition of A048704.] - Antti Karttunen, Jul 25 2013

A264618 Working in binary, write n followed by 0 then n-reversed (including leading zeros); show result in base 10.

Original entry on oeis.org

0, 5, 17, 27, 65, 85, 99, 119, 257, 297, 325, 365, 387, 427, 455, 495, 1025, 1105, 1161, 1241, 1285, 1365, 1421, 1501, 1539, 1619, 1675, 1755, 1799, 1879, 1935, 2015, 4097, 4257, 4369, 4529, 4617, 4777, 4889, 5049, 5125, 5285, 5397, 5557, 5645, 5805, 5917, 6077, 6147, 6307, 6419, 6579, 6667, 6827, 6939, 7099, 7175
Offset: 0

Views

Author

N. J. A. Sloane, Nov 30 2015

Keywords

Comments

a(n) = A264619(n) - A062383(n); n>0: A070939(a(n)) = 2*A070939(n)+1; A000120(a(n)) = 2*A000120(n); n>0: A023416(a(n)) = 2*A023416(n)+1. - Reinhard Zumkeller, Dec 01 2015

Examples

			0 -> 000 = 0,
1 -> 101 = 5,
10 -> 10001 = 17,
11 -> 11011 = 27,
100 -> 1000001 = 65,
...
		

Crossrefs

Cf. A006995, A048701 (n followed by n-reversed), A264619.
First differences: A265028.

Programs

  • Haskell
    a264618 n = foldr (\b v -> 2 * v + b) 0 $ (reverse bs ++ (0 : bs))
                where bs = map fromIntegral $ a030308_row n
    -- Reinhard Zumkeller, Dec 01 2015
  • Mathematica
    A264618[n_]:=FromDigits[Join[#, {0}, Reverse[#]], 2] &@IntegerDigits[n, 2] (* JungHwan Min, Dec 01 2015 *)

A264619 a(0) = 1; for n>0, working in binary, write n followed by 1 then n-reversed (including leading zeros); show result in base 10.

Original entry on oeis.org

1, 7, 21, 31, 73, 93, 107, 127, 273, 313, 341, 381, 403, 443, 471, 511, 1057, 1137, 1193, 1273, 1317, 1397, 1453, 1533, 1571, 1651, 1707, 1787, 1831, 1911, 1967, 2047, 4161, 4321, 4433, 4593, 4681, 4841, 4953, 5113, 5189, 5349, 5461, 5621, 5709, 5869, 5981, 6141, 6211, 6371, 6483, 6643, 6731, 6891, 7003, 7163, 7239
Offset: 0

Views

Author

N. J. A. Sloane, Nov 30 2015

Keywords

Comments

a(n) = A062383(n) + A264618(n); n>0: A070939(a(n)) = 2*A070939(n)+1; A000120(a(n)) = 2*A000120(n)+1; n>0: A023416(a(n)) = 2*A023416(n). - Reinhard Zumkeller, Dec 01 2015

Examples

			1 -> 111 = 7,
10 -> 10101 = 21,
11 -> 11111 = 31,
100 -> 1001001 = 73,
...
		

Crossrefs

Cf. A006995, A048701 (n followed by n-reversed), A264618.
First differences: A265029.

Programs

  • Haskell
    a264619 0 = 1
    a264619 n = foldr (\b v -> 2 * v + b) 0 $ (reverse bs ++ (1 : bs))
                where bs = map fromIntegral $ a030308_row n
    -- Reinhard Zumkeller, Dec 01 2015
  • Mathematica
    A264619[0] = 1; A264619[n_] := FromDigits[Join[#, {1}, Reverse[#]], 2]&@ IntegerDigits[n, 2] (* JungHwan Min, Dec 01 2015 *)
    bnr[n_]:=Module[{idn2=IntegerDigits[n,2]},FromDigits[Join[idn2,{1}, Reverse[ idn2]],2]]; Join[{1},Array[bnr,60]] (* Harvey P. Dale, Nov 05 2017 *)
Showing 1-10 of 14 results. Next