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

A178225 Characteristic function of A006995 (binary palindromes).

Original entry on oeis.org

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

Views

Author

Jeremy Gardiner, May 23 2010

Keywords

Comments

a(n)=1 if n is in A006995, a(n)=0 otherwise.
For n<43, identical to parity of A175096.
Comment by Franklin T. Adams-Watters: (Start)
Any permutation of the runs of n gives another such permutation when reversed. This pairs up all non-palindromic permutations of the runs of n. Thus the parity of A175096(n) is the parity of the number of palindromic run-permutations of n. For small n, this is 1 when n is a binary palindrome, and 0 otherwise.
The first exception is 43, binary 101011, which has a nontrivial palindromic run-permutation 45, binary 101101. Another kind of exception occurs first for n = 365, binary 101101101, which is a palindrome, but has another palindromic run-permutation 427, binary 110101011. (End)
Given an index n such that a(n)=1, then the following A164126(A206915(n))-1 terms will be 0. n'=A164126(A206915(n)) is the next term with a(n')=1. Therefore, if we subtract 1 from each term of A164126, we get the sequence of run lengths of 0's. - Hieronymus Fischer, Feb 19 2012.
Given an index n such that a(n)=0, then p=A206913(n) is the greatest index pA206914(n) is the least index q>n such that a(q)=1, which implies a(k)=0 for all k with n<=kHieronymus Fischer, Feb 19 2012.
Binary palindromes are distributed symmetrically with respect to threefold multiples of powers of 2. This becomes obvious by the generating function g(x) below. Example for the resulting factors of x^(3*2^5)=x^96: the factors are x^q and x^(-q) for q=3,11,23,31. Thus, the palindromes are 96+3, 96-3, 96+11, 96-11, 96+23, 96-23, 96+31, 96-31. The respective number of palindromes with this property is 2^(floor(m/2)), where m is the exponent of the corresponding power of 2. - Hieronymus Fischer, Apr 04 2012

Examples

			a(3)=1, since 3 is binary palindromic;
a(4)=0, since 4 is not palindromic.
		

Crossrefs

Cf. A136522. See A206915 for the partial sums.

Programs

  • Haskell
    a178225 n = fromEnum $ n == a030101 n  -- Reinhard Zumkeller, Oct 21 2011
    
  • Mathematica
    A178225[n_]:=Boole[PalindromeQ[IntegerDigits[n,2]]];
    Array[A178225,100,0] (* Paolo Xausa, Oct 15 2023 *)
  • PARI
    a(n) = my(b=binary(n)); b == Vecrev(b); \\ Michel Marcus, Feb 13 2019
    
  • Python
    a187225 = lambda n: int(bin(n)[2:] == bin(n)[:1:-1]) # David Radcliffe, May 05 2023

Formula

a(A006995(n)) = 1; a(A154809(n)) = 0. - Reinhard Zumkeller, Oct 21 2011
a(n) = if A030101(n) = n then 1, otherwise 0. - Reinhard Zumkeller, Jan 17 2012
a(n) = 1 - (A206916(n) - A206915(n)). - Hieronymus Fischer, Feb 18 2012
G.f.: g(x) = 1 + x + x^3 + Sum{j>=1} x^(3*2^j)*(f_j(x)+f_j(1/x)), where the f_j(x) are defined as follows:
f_1(x)=x, and for j > 1,
f_j(x) = x^3*Product_{k=1..floor((j-1)/2)} (1+x^b(j,k)), 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). The first explicit terms of this g.f. are
g(x) = 1 + x + x^3 + (f_1(x) + f_1(1/x))*x^6 + (f_2(x) + f_2(1/x))*x^12 + (f_3(x)+f_3(1/x))*x^24 + (f_4(x) + f_4(1/x))*x^48 + (f_5(x) + f_5(1/x))*x^96 + ... = 1 + x + x^3 + (x+1/x)*x^6 + (x^3+1/x^3)*x^12 + (x^3*(1+x^4) + (1+1/x^4)/x^3)*x^24 + (x^3*(1+x^12) + (1+1/x^12)/x^3)*x^48 + (x^3*(1+x^8)(1+x^20) + (1+1/x^20)(1+1/x^8)/x^3)*x^96 + ... - Hieronymus Fischer, Apr 02 2012

A206915 The index (in A006995) of the greatest binary palindrome <= n; also the 'lower inverse' of A006995.

Original entry on oeis.org

1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16
Offset: 0

Views

Author

Hieronymus Fischer, Feb 15 2012

Keywords

Comments

The greatest m such that A006995(m)<= n;
The number of binary palindromes <= n;
n is palindromic iff a(n)=A206916(n);
a(n) is the number of the binary palindrome A206913(n);
if n is a binary palindrome, then A006995(a(n))=n, so a(n) is 'inverse' with respect to A006995.
Partial sums of the binary palindromic characteristic function A178225.

Examples

			a(1)=2 since 2 is the index number of the greatest binary palindrome <= 1;
a(5)=4 since there are only 4 binary palindromes (namely 0,1,3 and 5) which are less than or equal to 5;
a(10)=6 since A006995(6)=9<=10, but A006995(7)=15>10, and so that, 6 is the index number of greatest binary palindrome <= 10;
		

Crossrefs

Programs

  • Mathematica
    A178225[n_]:=Boole[PalindromeQ[IntegerDigits[n,2]]];
    Accumulate[Array[A178225,100,0]] (* Paolo Xausa, Oct 15 2023 *)
  • Python
    def A206915(n):
        l = n.bit_length()
        k = l+1>>1
        return (n>>l-k)-(int(bin(n)[k+1:1:-1] or '0',2)>(n&(1<Chai Wah Wu, Jul 24 2024

Formula

a(n) = max(m | A006995(m) <= n);
a(A006995(n)) = n;
A006995(a(n)) <= n, equality holds true iff n is a binary palindrome;
Let p = A206913(n), m = floor(log_2(p)) and p>2, then:
a(n) = (((5-(-1)^m)/2) + sum_{k=1..floor(m/2)} (floor(p/2^k) mod 2)/2^k)) * 2^floor(m/2).
a(n) = (1/2)*((6-(-1)^m)*2^floor(m/2) - 1 - sum_{k=1..floor(m/2)} (-1)^floor(p/2^k) * 2^(floor(m/2)-k))).
a(n) = (5-(-1)^m) * 2^floor(m/2)/2 - 3*sum_{k=2..floor(m/2)} (floor(p/2^k) * 2^floor(m/2)/2^k) + (floor(p/2) * 2^floor(m/2)/2 - 2*floor((p/2) * 2^floor(m/2)) * floor((m-1)/m+1/2).
Partial sums S(n) = sum_{k=0..n} a(k):
S(n) = (n+1)*a(n) - A206920(a(n)).
G.f.: g(x) = (1+x+x^3+sum_{j>=1} x^(3*2^j)*(f_j(x)+f_j(1/x)))/(1-x), where the f_j(x) are defined as follows:
f_1(x) = x, and for j>1,
f_j(x) = x^3*product_{k=1..floor((j-1)/2)} (1+x^b(j,k)), 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).

A044051 a(n) = (s(n)+1)/2, where s=A006995 (base-2 palindromes).

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 9, 11, 14, 16, 17, 23, 26, 32, 33, 37, 43, 47, 50, 54, 60, 64, 65, 77, 83, 95, 98, 110, 116, 128, 129, 137, 149, 157, 163, 171, 183, 191, 194, 202, 214, 222, 228, 236, 248, 256, 257, 281, 293, 317, 323, 347, 359, 383
Offset: 1

Views

Author

Melia Aldridge, ma38(AT)spruce.evansville.edu

Keywords

Comments

A141707(a(n)) = 1. - Reinhard Zumkeller, Apr 20 2015

Crossrefs

Programs

  • Haskell
    a044051 = (`div` 2) . (+ 1) . a006995 . (+ 1)
    -- Reinhard Zumkeller, Apr 20 2015

Formula

Let n >= 3, m=floor(log_2(n)), p=floor((3*2^(m-1)-1)/n); then a(n) = 2^(2*m-2-p) + 1 + p*(1-(-1)^n)*2^(m-1) + (1/2)*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)). - Hieronymus Fischer, Feb 18 2012

A206920 Sum of the first n binary palindromes; a(n) = Sum_{k=1..n} A006995(k).

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 40, 57, 78, 105, 136, 169, 214, 265, 328, 393, 466, 551, 644, 743, 850, 969, 1096, 1225, 1378, 1543, 1732, 1927, 2146, 2377, 2632, 2889, 3162, 3459, 3772, 4097, 4438, 4803, 5184, 5571, 5974, 6401, 6844, 7299, 7770, 8265, 8776, 9289, 9850
Offset: 1

Views

Author

Hieronymus Fischer, Feb 18 2012

Keywords

Comments

Different from A206919.

Examples

			a(1) = 0, since A006995(1) = 0;
a(4) = 9, since the sum of the first 4 binary palindromes is 9 = 0 + 1 + 3 + 5.
		

Crossrefs

Programs

  • Haskell
    a206920 n = a206920_list !! (n-1)
    a206920_list = scanl1 (+) a006995_list
    -- Reinhard Zumkeller, Feb 27 2012
  • Mathematica
    Accumulate@ Map[FromDigits[#, 2] &, Select[Array[IntegerDigits[#, 2] &, 600, 0], PalindromeQ]] (* Michael De Vlieger, Feb 20 2018 *)

Formula

Let n > 3, p = A006995(n), m = floor(log_2(p)), then
a(n) = (8/7)*((3/4)*(4 - (-1)^m)/(3 + (-1)^m)*2^(3*floor(m/2)) - 1) + (floor(p/2^floor(m/2)) mod 2)*p + 2^m + 1 + Sum_{k = 1..(floor(m/2) - 1)} (floor(p/2^k) mod 2)*(2^k + 2^(m-k) + 2^(m-floor(m/2) + 1)*(4^(floor(m/2) - k - 1) - 1) + (2 - (-1)^m)*2^floor(m/2) + 2^(floor(m/2) - k)*(p - floor((p mod (2^(m-k+1)))/2^k)*2^k)). - [Corrected; missing factor to the sum term (2 -(-1)^m) pasted by the author, Sep 07 2018]
From Hieronymus Fischer, Sep 07 2018: (Start)
Slightly simplified and better readable formula:
a(n) = A_m + B_m + 2^m + 1 + Sum_{k = 1..(m2-1)} C_k*(D_k + E_k + F_k + G_k),
where m2 = floor(m/2),
A_m = (8/7)*((3/4)*(4-(-1)^m)/(3+(-1)^m)*2^(3*m2)-1),
B_m = p*(floor(p/2^m2) mod 2),
C_k = floor(p/2^k) mod 2,
D_k = 2^k + 2^(m-k),
E_k = 2^(m-m2+1)*(4^(m2-k-1)-1),
F_k = (2 - (-1)^m)*2^m2,
G_k = 2^(m2-k) * (p - p mod (2^(m-k+1)) + p mod 2^k). (End)
G.f.: g(x) = (x^2 + 3x^3 + Sum_{j >= 1} (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)))/(1-x), where the f_j(x) are the same as defined for the g.f. of A006995.

A206916 Index of the least binary palindrome >=n; also the "upper inverse" of A006995.

Original entry on oeis.org

1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 17, 17, 17, 17, 17
Offset: 0

Views

Author

Hieronymus Fischer, Feb 17 2012

Keywords

Comments

The least m such that A006995(m)>=n;
n is palindromic iff a(n)=A206915(n);
a(n) is the number of the binary palindrome A206914(n);
if n is a binary palindrome, then A006995(a(n))=n, so a(n) is 'inverse' with respect to A006995

Examples

			a(2)=3 since 3 is the index number of the least binary palindrome >= 2;
a(5)=4 since 4 is the index number of the least binary palindrome >= 5;
a(10)=7 since A006995(7)=15>=10, but A006995(6)=9<10, and so that, 7 is the index number of least binary palindrome >= 10;
		

Crossrefs

Programs

  • Python
    def A206916(n):
        l = n.bit_length()
        k = l+1>>1
        return (n>>l-k)+(int(bin(n)[k+1:1:-1] or '0',2)<(n&(1<Chai Wah Wu, Jul 24 2024

Formula

a(n)=min(m|A006995(m)>=n);
a(A006995(n))=n;
A006995(a(n))>=n, equality holds true iff n is a binary palindrome;
Let p=A206914(n), m=floor(log_2(p)) and p>2, then:
a(n)=(((5-(-1)^m)/2) + sum_{k=1..floor(m/2)} (floor(p/2^k) mod 2)/2^k))*2^floor(m/2);
a(n)=(1/2)*((6-(-1)^m)*2^floor(m/2)-1-sum_ {k=1..floor(m/2)} (-1)^floor(p/2^k)*2^(floor(m/2)-k)));
a(n)=(5-(-1)^m)*2^floor(m/2)/2-3*sum_{k=2..floor(m/2)} floor(p/2^k)*2^floor(m/2)/2^k)+(floor(p/2)*2^floor(m/2)/2-2*floor((p/2)*2^floor(m/2))*floor((m-1)/m+1/2).
Partial sums S(n) = sum_{k=0..n} a(k):
S(n) = 1+n*a(n)-A206920(a(n)-1), valid for n>0.
G.f.: g(x)=(x+x^2+x^3+sum_{j=1..infinity} x^(3*2^j)*(f_j(x)+f_j(1/x)))/(x(1-x)), where the f_j(x) are defined as follows:
f_1(x)=x, and for j>1,
f_j(x)=x^3*product_{k=1..floor((j-1)/2)} (1+x^b(j,k)), 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).

A217099 Binary palindromes (cf. A006995) such that the number of contiguous palindromic bit patterns is minimal (for a given number of places).

Original entry on oeis.org

0, 1, 3, 5, 9, 17, 21, 27, 45, 51, 73, 93, 99, 107, 153, 165, 297, 313, 325, 403, 717, 843, 1241, 1421, 1619, 1675, 2409, 2661, 4841, 4953, 5349, 5709, 13011, 13515, 21349, 22861, 26067, 27083, 38505, 39513, 76905, 78937, 85349, 108235, 183117, 208083, 307817, 366413, 415955, 432843, 632409
Offset: 1

Views

Author

Hieronymus Fischer, Jan 23 2013

Keywords

Comments

For a given number of places m a binary palindrome has at least 2*(m-1) + floor((m-3)/2) palindromic substrings. To a certain extent, this number indicates the minimal possible grade of symmetry.
a(n) is the least binary palindrome > a(n-1) which have the same number of palindromic substrings than a(n-1). If such a palindrome doesn't exist, a(n) is the least binary palindrome with one additional digit which meets the minimal possible number of palindromic substrings for such increased number of digits.
b_left(n) := floor(a(n)/2^log_2(a(n))) is a term of A206926, if n > 3. More precise, the bit pattern of b_left(n) is contained in the concatenation of the bit patterns of 37 or of 41, provided n > 16.
b_right(n) := a(n) mod (2^(1+log_2(a(n))) is a term of A206926, if n > 6. More precise, the bit pattern of b_right(n) is contained in the concatenation of the bit patterns of 37 or of 41, provided n > 16.
Provided n > 16: The bit pattern of b_left(n) is contained in the continued concatenation of the bit pattern of 37 (or 41, respectively) if and only if the bit pattern of b_ right(n) is contained in the continued concatenation of the bit pattern of 41 (or 37, respectively).

Examples

			a(1) = 0, since 0 is a binary palindrome with 1 palindromic substring (=0) which is the minimum for binary palindromes with 1 place.
a(2) = 1, since 1 is a binary palindrome with 1 palindromic substring (=1) which is the minimum for binary palindromes with 1 place.
a(8) = 27, since 27=11011_2 is a binary palindrome with 9 palindromic substrings which is the minimum for binary palindromes with 5 places.
a(9) = 45, since 45=101101_2 is a binary palindrome with 11 palindromic substrings which is the minimum for binary palindromes with 6 places.
		

Crossrefs

Programs

  • Smalltalk
    "Calculates a(n) - not optimized.
    If the complete array 'answer' is answered instead of a separate term, the next 2 (if d is even) or 4 (if d is odd) terms are calculated simultaneously"
    | n min d B k j p q answer |
    answer := OrderedCollection new.
    n := self.
    B := #(0 1 3 5 9 17 21 27 45 51 73 93 99 107 153 165).
    n <= 16 ifTrue: [^s := B at: n].
    k := (n - 5) // 6 - 1.
    j := (n - 5) \\ 6 + 1.
    d := 2 * k + 7 + (j // 5).
    min := (d - 1) * 2 + ((d - 3) // 2).
    0 to: 5
      do:
       [:i |
       p := (6 * k + 4 + i) A206926.
       s := p * (2 raisedToInteger: d // 2).
       q := p // (2 - (j // 5)) reverse: 2.
       s A206925 = min ifTrue: [answer add: (s + q)]].
    ^answer at: j - (j // 5 * 4) [by Hieronymus Fischer]

Formula

a(n) = min(p > a(n-1) | p is binary palindrome and A206925(p) = A206925(a(n-1))), if this minimum exists, else a(n) = min(p > 2*2^floor(log(a(n-1))) | p is binary palindrome and A206925(p) = min(A206925(q) | q is binary palindrome and q > 2*2^floor(log(a(n-1))))).
a(n) = A006995(j), where j := j(n) = min(k > A206915(a(n-1)) | A206924(k) = A206925(a(n-1)), if this minimum exists, else j(n) = min(k > A206915(2*2^floor(log(a(n-1)))) | A206924(k) = min(a206925(A006995(i)) | i > A206915(2*2^floor(log(a(n-1)))))).
With k := k(n) = floor((n - 5)/6) - 1, j := j(n) = (n - 5) mod 6 + 1, d = 2k+7+floor(j/5),
c = 2*(d-1) + floor((d-3)/2), f(i) = A206926(6k + 4 + i)*2^floor(d/2) + Reversal(floor((A206926(6k + 4 + i))/(2 - floor(j/5)))), for i=0..5, we have
a(n) = b(j - 4*floor(j/5)), where b(m) = f(min(m-1<=i<=5 | A206925(f(i)) = c and f(i) <> b(l) for 1<=l
With m = 1+floor(log_2(a(n)), n > 3:
A206924(k) = 2(m-1) + floor((m-3)/2), where k is that uniquely determined number for which A006995(k) = a(n).
A206924(A206915(a(n))) = 2(m-1) + floor((m-3)/2).
A206924(A206915(a(n))) = 3*floor(log_2(A206915(a(n)))) + 2*floor(log_2(A206915(a(n))/3)) - 2, n > 3.

A164126 First differences of A006995.

Original entry on oeis.org

1, 2, 2, 2, 2, 6, 2, 4, 6, 4, 2, 12, 6, 12, 2, 8, 12, 8, 6, 8, 12, 8, 2, 24, 12, 24, 6, 24, 12, 24, 2, 16, 24, 16, 12, 16, 24, 16, 6, 16, 24, 16, 12, 16, 24, 16, 2, 48, 24, 48, 12, 48, 24, 48, 6, 48, 24, 48, 12, 48, 24, 48, 2, 32, 48, 32, 24, 32, 48, 32, 12, 32, 48, 32, 24, 32, 48, 32, 6
Offset: 1

Author

Keywords

Comments

Contribution from Hieronymus Fischer, Feb 18 2012: (Start)
From the formula section it follows that a(2^m - 1 + 2^(m-1) - k) = a(2^m - 1 + k) for 0 <= k <= 2^(m-1), as well as a(2^m - 1 + 2^(m-1) - k) = 2 for k=0, 2^(m-1) and a(2^m - 1 + 2^(m-1) - k) = 6 for k=2^(m-2), hence, starting from positions n=2^m-1, the following 2^(m-1) terms form symmetric tuples limited on the left and on the right by a '2' and always having a '6' as the center element.
Example: for n = 15 = 2^4 - 1, we have the (2^3+1)-tuple (2,8,12,8,6,8,12,8,2).
Further on, since a(2^m - 1 + 2^(m-1) + k) = a(2^(m+1) - 1 - k) for 0 <= k <= 2^(m-1) an analogous statement holds true for starting positions n = 2^m + 2^(m-1) - 1.
Example: for n = 23 = 2^4 + 2^3 - 1, we find the (2^3+1)-tuple (2,24,12,24,6,24,12,24,2).
If we group the sequence terms according to the value of m=floor(log_2(n)), writing those terms together in separate lines and opening each new line for n >= 2^m + 2^(m-1), then a kind of a 'logarithmic shaped' cone end will be formed, where both the symmetry and the calculation rules become obvious. The first 63 terms are depicted below:
1
2
2
2 2
6 2
4 6 4 2
12 6 12 2
8 12 8 6 8 12 8 2
24 12 24 6 24 12 24 2
16 24 16 12 16 24 16 6 16 24 16 12 16 24 16 2
48 24 48 12 48 24 48 6 48 24 48 12 48 24 48 2
.
(End)
Decremented by 1, also the sequence of run lengths of 0's in A178225. - Hieronymus Fischer, Feb 19 2012

Examples

			a(1) = A006995(2) - A006995(1) = 1 - 0 = 1.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=FromDigits[RealDigits[n,2][[1]]]==FromDigits[Reverse[RealDigits[n, 2][[1]]]]; a=1;lst={};Do[If[f[n],AppendTo[lst,n-a];a=n],{n,1,8!,1}]; lst
  • Python
    def A164126(n):
        if n == 1: return 1
        m = (a:=1<<(l:=n.bit_length()-2))|(n&a-1)
        k = (m<Chai Wah Wu, Jun 11 2024

Formula

a(n) = A006995(n+1) - A006995(n).
Contribution from Hieronymus Fischer, Feb 17 2012: (Start)
a(4*2^m - 1) = a(6*2^m - 1) = 2;
a(5*2^m - 1) = a(7*2^m - 1) = 6 (for m > 0);
Let m = floor(log_2(n)), then
Case 1: a(n) = 2, if n+1 = 2^(m+1) or n+1 = 3*2^(m-1);
Case 2: a(n) = 2^(m-1), if n = 0(mod 2) and n < 3*2^(m-1);
Case 3: a(n) = 3*2^(m-1), if n = 0(mod 2) and n >= 3*2^(m-1);
Case 4: a(n) = 3*2^(m-1)/gcd(n+1-2^m, 2^m), otherwise.
Cases 2-4 above can be combined as
Case 2': a(n) = (2 - (-1)^(n-(n-1)*floor(2*n/(3*2^m))))*2^(m-1)/gcd(n+1-2^m, 2^m).
Recursion formula:
Let m = floor(log_2(n)); then
Case 1: a(n) = 2*a(n-2^(m-1)), if 2^m <= n < 2^m + 2^(m-2) - 1;
Case 2: a(n) = 6, if n = 2^m + 2^(m-2) - 1;
Case 3: a(n) = a(n-2^(m-2)), if 2^m + 2^(m-2) <= n < 2^m + 2^(m-1) - 1;
Case 4: a(n) = 2, if n = 2^m + 2^(m-1) - 1;
Case 5: a(n) = (2 + (-1)^n)*a(n-2^(m-1)), otherwise (which means 2^m + 2^(m-1) <= n < 2^(m+1)).
(End)

Extensions

a(1) changed to 1 and keyword:base added by R. J. Mathar, Aug 26 2009

A261679 Number of ordered pairs (u,v) of binary palindromes (see A006995) with u+v=n.

Original entry on oeis.org

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

Author

N. J. A. Sloane, Sep 04 2015

Keywords

Examples

			8=1+7=3+5=5+3=7+1, so a(8)=4.
		

Crossrefs

For zeros see A241491, A261678.

Formula

G.f. = (Sum_{p in A006995} x^p)^2.

A261680 Number of ordered quadruples (u,v,w,x) of binary palindromes (see A006995) with u+v+w+x=n.

Original entry on oeis.org

1, 4, 6, 8, 13, 16, 22, 28, 34, 44, 50, 60, 59, 72, 70, 80, 92, 88, 114, 96, 125, 104, 152, 120, 172, 144, 188, 152, 215, 144, 242, 160, 272, 172, 302, 180, 329, 216, 352, 240, 388, 228, 430, 228, 442, 212, 476, 192, 506, 228, 496, 248, 540, 252, 582, 276, 592
Offset: 0

Author

N. J. A. Sloane, Sep 04 2015

Keywords

Comments

Conjecture: a(n)>0: every number is the sum of four binary palindromes. (Compare A261422, A261675.)

Crossrefs

Formula

G.f. = (Sum_{p in A006995} x^p)^4.

A305468 Positive integers that can be expressed as the quotient of two binary palindromic numbers (that is, terms of A006995).

Original entry on oeis.org

1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 27, 31, 33, 39, 43, 45, 51, 53, 55, 57, 61, 63, 65, 71, 73, 77, 79, 83, 85, 91, 93, 95, 99, 107, 109, 117, 119, 121, 127, 129, 133, 143, 149, 151, 153, 157, 159, 163, 165, 171, 173, 179, 181, 187, 189, 191, 195, 203, 205
Offset: 1

Author

Jeffrey Shallit, Jun 02 2018

Keywords

Examples

			79 is in the sequence because 888987 and 11253 are both binary palindromes, and 79 = 888987/11253.  These are in fact the smallest such numbers for 79.
		

Crossrefs

Showing 1-10 of 233 results. Next