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.

Previous Showing 11-20 of 29 results. Next

A233571 In balanced ternary notation, reverse digits of a(n) equals to -a(n).

Original entry on oeis.org

0, 2, 8, 20, 26, 32, 56, 80, 104, 146, 164, 182, 224, 242, 260, 302, 320, 338, 416, 488, 560, 656, 728, 800, 896, 968, 1040, 1172, 1226, 1280, 1406, 1460, 1514, 1640, 1694, 1748, 1898, 1952, 2006, 2132, 2186, 2240, 2366, 2420, 2474, 2624, 2678, 2732, 2858
Offset: 1

Views

Author

Lei Zhou, Dec 13 2013

Keywords

Examples

			In balanced ternary notation, 8=(10T)_bt, where we use T to represent -1.  Reverse digits of (10T)_bt is (T01)_bt = -8. So 8 is in this sequence.
Similarly, 2240 = (1001T00T)_bt, whose reverse digits is (T00T1001)_bt = -2240.  So 2240 is in this sequence.
		

Crossrefs

Programs

  • Mathematica
    BTDigits[m_Integer, g_] :=
    Module[{n = m, d, sign, t = g},
      If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n];
       d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++];
       While[Length[t] < d, PrependTo[t, 0]]; t[[Length[t] + 1 - d]] = sign;
       t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
    ct = 1; n = 0; m = 0; dg = 0; switch = 1; res = {0}; While[ct < 50, n++;
      bits = BTDigits[n, {0}]; If[lb = Length[bits]; lb > dg,
      If[switch == 0, n = m; switch = 1; OK = 0, dg = lb; m = n - 1;
       switch = 0; OK = 1], OK = 1];  If[OK == 1, rbt = -Reverse[bits];
      If[switch == 1, nb = Join[bits, {0}], nb = bits];
      nb = Join[nb, rbt]; nb = Reverse[nb]; data = 0;
      Do[data = data + 3^(i - 1)*nb[[i]], {i, 1, Length[nb]}]; ct++;
      AppendTo[res, data]]]; res

A233572 In balanced ternary notation, if prepending same numbers of zeros, reverse digits of a(n) equals to -a(n).

Original entry on oeis.org

0, 2, 6, 8, 18, 20, 24, 26, 32, 54, 56, 60, 72, 78, 80, 96, 104, 146, 162, 164, 168, 180, 182, 216, 224, 234, 240, 242, 260, 288, 302, 312, 320, 338, 416, 438, 486, 488, 492, 504, 540, 546, 560, 648, 656, 672, 702, 720, 726, 728, 780, 800, 864, 896, 906, 936
Offset: 1

Views

Author

Lei Zhou, Dec 13 2013

Keywords

Comments

A233571 is a subset of this sequence.

Examples

			In balanced ternary notation, 18 = (1T00)_bt, where we use T to represent -1.  Patching two zeros before it, (1T00)_bt=(001T00)_bt.  The reverse digits of (001T00)_bt is (00T100)_bt = -18.  So 18 is in this sequence.
		

Crossrefs

Programs

  • Mathematica
    BTDigits[m_Integer, g_] :=
    Module[{n = m, d, sign, t = g},
      If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n];
       d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++];
       While[Length[t] < d, PrependTo[t, 0]]; t[[Length[t] + 1 - d]] = sign;
       t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
    BTrteQ[n_Integer] :=
    Module[{t, trim = n/3^IntegerExponent[n, 3]},
      t = BTDigits[trim, {0}]; DeleteDuplicates[t + Reverse[t]] == {0}];
    sb = Select[Range[0, 950], BTrteQ[#] &]

A273245 Non-palindromic binary numbers whose reversal is a palindrome.

Original entry on oeis.org

10, 100, 110, 1000, 1010, 1100, 1110, 10000, 10010, 10100, 11000, 11100, 11110, 100000, 100010, 100100, 101000, 101010, 110000, 110110, 111000, 111100, 111110, 1000000, 1000010, 1000100, 1001000, 1010000, 1010100, 1011010, 1100000, 1100110, 1101100, 1110000, 1111000, 1111100
Offset: 1

Views

Author

Giovanni Teofilatto, May 18 2016

Keywords

Crossrefs

Cf. A006995, A273329, A272670 (this sequence written in base 10), A057890 (and divided by 2).

Programs

  • Maple
    # see A272670 for the other subroutines
    for n from 1 to 400 do
        if isA272670(n) then
            printf("%d,",A007088(n)) ;
        end if;
    end do: # R. J. Mathar, May 20 2016
  • Python
    A273245_list = [int(m) for m in (bin(n)[2:] for n in range(1,10**4)) if m != m[::-1] and m.rstrip('0') == m[::-1].lstrip('0')] # Chai Wah Wu, May 21 2016

Formula

Consists of binary palindromes (A006995) times nontrivial powers of 2, that is, 2^i, i>0. - N. J. A. Sloane, May 19 2016
a(n) = A007088(A272670(n)). - R. J. Mathar, May 20 2016

A272670 Numbers whose binary expansion is not palindromic but which when reversed and leading zeros omitted, does form a palindrome.

Original entry on oeis.org

2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 24, 28, 30, 32, 34, 36, 40, 42, 48, 54, 56, 60, 62, 64, 66, 68, 72, 80, 84, 90, 96, 102, 108, 112, 120, 124, 126, 128, 130, 132, 136, 144, 146, 160, 168, 170, 180, 186, 192, 198, 204, 214, 216, 224, 238, 240, 248, 252, 254
Offset: 1

Views

Author

N. J. A. Sloane, May 19 2016

Keywords

Comments

Decimal interpretation of A273245. Twice A057890.

Crossrefs

Cf. A006995, A057890, A273245, A273329, subsequence of A154809.

Programs

  • Maple
    isPal := proc(L::list)
        local i;
        for i from 1 to nops(L)/2 do
            if op(i,L) <> op(-i,L) then
                return false;
            end if;
        end do:
        true ;
    end proc:
    isA272670 := proc(n)
        local bdgs ;
        bdgs := convert(n,base,2) ;
        if isPal(bdgs) then
            return false;
        else
            A000265(n) ;
            bdgs := convert(%,base,2) ;
            isPal(bdgs) ;
        end if;
    end proc:
    for n from 1 to 500 do
        if isA272670(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, May 20 2016
  • Python
    A272670_list = [n for n in range(1,10**4) if bin(n)[2:] != bin(n)[:1:-1] and bin(n)[2:].rstrip('0') == bin(n)[:1:-1].lstrip('0')] # Chai Wah Wu, May 21 2016

A274036 a(n) is the thickness of n (see Comments section for definition).

Original entry on oeis.org

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

Views

Author

Gheorghe Coserea, Jun 07 2016

Keywords

Comments

Let b_k..b_0 be the binary representation of n and B_n(x) = b_k*x^k + .. + b_0 the associated polynomial with n = B_n(2); we define the thickness of n to be the thickness of B_n, i.e., the magnitude of the largest coefficient in the expansion of B_n(x)^2 (see A169950).
The thickness histogram for numbers in the interval I_n = [2^n, 2^(n+1)-1] is given by row n of triangle A169950, i.e., A169950(n,k) = card {p, p in I_n and a(p) = k}.
In general a(n) <= A000120(n), with equality only if in base-2 n becomes a palindrome after trailing 0's (if any) are omitted, i.e., n = A057890(k) for some k; the number of such numbers in I_n having binary weight (and thickness) w is given by A207974(n,w-1), i.e., A207974(n,w-1) = card {k, A057890(k) in I_n and A000120(A057890(k)) = w}; the total number of these numbers in the interval I_n is given by A027383(n), i.e., card {p, p in I_n and a(p) = A000120(p)} = A027383(n) = 2^floor((n+2)/2) + 2^floor((n+1)/2) - 2.

Examples

			For n = 3 we have the base-2 representation 11, the associated polynomial B_3(x) = x + 1, B_3(x)^2 = x^2 + 2*x + 1 and the magnitude of the largest coefficient in the expansion of B_3(x)^2 is 2, therefore a(3) = 2.
For n = 4 we have the base-2 representation 100, the associated polynomial B_4(x) = x^2, B_4(x)^2 = x^4 and the magnitude of the largest coefficient in the expansion of B_4(x)^2 is 1, therefore a(4) = 1.
		

Crossrefs

Programs

  • Mathematica
    Table[Max@ CoefficientList[#, x] &[SeriesData[x, 0, #, 0, Length@ #, 1]^2] &@ Reverse@ IntegerDigits[n, 2], {n, 120}] (* Michael De Vlieger, Jun 08 2016 *)
  • PARI
    a(n) = my(pol = Pol(binary(n))); return(vecmax(Vec(sqr(pol))));
    concat(0, vector(100, n, a(n)))
    
  • PARI
    bitrev(n) = subst(Pol(Vecrev(binary(n>>valuation(n,2))), 'x), 'x, 2);
    a(n) = {
      my(e = logint(n, 2), r = bitrev(n) << e, v = vector(2*e+1));
      for (i = 1, #v, v[i] = hammingweight(bitand(r, n)); r >>= 1);
      return(vecmax(v));
    };
    concat(0, vector(100, n, a(n)))

Formula

a(n) <= A000120(n), with equality iff n = A057890(k).

A342121 a(n) is the remainder when the larger of n and its binary reverse is divided by the smaller.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 9, 6, 0, 6, 4, 0, 0, 6, 0, 0, 0, 0, 0, 14, 0, 4, 13, 18, 0, 4, 0, 10, 5, 0, 17, 14, 0, 14, 12, 0, 8, 10, 0, 4, 0, 18, 12, 4, 0, 14, 0, 0, 0, 0, 0, 30, 0, 12, 21, 42, 0, 0, 33, 30, 1, 12, 21, 42, 0
Offset: 1

Views

Author

Rémy Sigrist, Feb 28 2021

Keywords

Comments

The binary reverse of a number is given by A030101.
This sequence is the analog of A061467 for the binary base.

Examples

			For n = 43,
- the binary reverse of 43 ("101011" in binary) is 53 ("110101" in binary),
- so a(43) = 53 mod 43 = 10.
		

Crossrefs

Programs

  • Mathematica
    rbr[n_]:=Module[{r=IntegerReverse[n,2]},If[r>n,Mod[r,n],Mod[n,r]]]; Array[rbr,100] (* Harvey P. Dale, Mar 18 2023 *)
  • PARI
    a(n, base=2) = { my (r=fromdigits(Vecrev(digits(n, base)), base)); max(n, r) % min(n, r) }
    
  • Python
    def A342121(n):
        a, b = sorted([n,int(bin(n)[:1:-1],2)])
        return b % a if n > 0 else 0 # Chai Wah Wu, Mar 01 2021

Formula

a(n) = max(n, A030101(n)) mod min(n, A030101(n)).
a(n) = min(A342122(n), A342123(n)).
a(n) < n.
a(n) = 0 iff n belongs to A057890.

A342123 a(n) is the remainder when n is divided by its binary reverse.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 2, 0, 0, 0, 0, 0, 19, 0, 0, 9, 23, 0, 6, 4, 0, 0, 6, 0, 0, 0, 0, 0, 35, 0, 37, 13, 39, 0, 4, 0, 43, 5, 0, 17, 47, 0, 14, 12, 0, 8, 10, 0, 55, 0, 18, 12, 4, 0, 14, 0, 0, 0, 0, 0, 67, 0, 69, 21, 71, 0, 0, 33, 75, 1, 77, 21
Offset: 1

Views

Author

Rémy Sigrist, Feb 28 2021

Keywords

Comments

The binary reverse of a number is given by A030101.
This sequence is the analog of A071955 for the binary base.

Examples

			For n = 43,
- the binary reverse of 43 ("101011" in binary) is 53 ("110101" in binary),
- so a(43) = 43 mod 53 = 43.
		

Crossrefs

Programs

  • PARI
    a(n, base=2) = { my (r=fromdigits(Vecrev(digits(n, base)), base)); n%r }
    
  • Python
    def A342123(n): return n % int(bin(n)[:1:-1],2) if n > 0 else 0 # Chai Wah Wu, Mar 01 2021

Formula

a(n) = n mod A030101(n).
a(n) <= n with equality iff n belongs to A161601.
a(n) = 0 iff n belongs to A057890.

A366378 Numbers k such that A057889(k) == k (mod 3), where A057889 is the bijective bit-reverse.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 36, 38, 39, 40, 42, 45, 46, 48, 50, 51, 54, 56, 57, 58, 60, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 83, 84, 85, 87, 89, 90, 91, 92, 93, 95, 96, 97, 99, 100, 101, 102, 103
Offset: 1

Views

Author

Antti Karttunen, Oct 22 2023

Keywords

Crossrefs

Cf. A030101, A057889, A366379 (complement), A366389.
Subsequences: A000079, A008585, A057890.

Programs

A161604 A positive integer k is included if the value of (the reversal of k's representation in binary) divides k.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 21, 24, 27, 28, 30, 31, 32, 33, 34, 36, 40, 42, 45, 48, 51, 54, 56, 60, 62, 63, 64, 65, 66, 68, 72, 73, 80, 84, 85, 90, 93, 96, 99, 102, 107, 108, 112, 119, 120, 124, 126, 127, 128, 129, 130, 132, 136, 144, 146, 153
Offset: 1

Views

Author

Leroy Quet, Jun 14 2009

Keywords

Comments

By "reversal" of k's representation in binary, it is meant: write k in binary, reverse the order of its digits, and read the result as a binary value.
It seems (verified for the first 120000 entries) that a(n) = A057890(n+1). - R. J. Mathar, Jun 18 2009
Indeed, this is A057890 (palindromes with optional trailing zeros) without the initial term. In other bases this does not have to be so, as illustrated by A071687. - Ivan Neretin, Sep 04 2015

Examples

			24 in binary is 11000. The reversal of this is 11 (ignoring leading 0's), which is 3 in decimal. Since 3 divides 24, then 24 is included in this sequence.
		

Crossrefs

Programs

  • Maple
    A030101 := proc(n) local bdgs ; bdgs := convert(n,base,2) ; add( op(-i,bdgs)*2^(i-1),i=1..nops(bdgs)) ; end: isA161604 := proc(n) if ( n mod A030101(n) ) = 0 then true ; else false; fi; end: for n from 1 to 600 do if isA161604(n) then printf("%d,",n) ; fi; od: # R. J. Mathar, Jun 18 2009
  • Mathematica
    Select[Range@ 153, Divisible[#, FromDigits[Reverse@ IntegerDigits[#, 2], 2]] &] (* Michael De Vlieger, Sep 04 2015 *)
  • PARI
    is(n, base=2) = my (r=fromdigits(Vecrev(digits(n, base)), base)); n%r==0 \\ Rémy Sigrist, Apr 04 2020

Extensions

Extended by R. J. Mathar, Jun 18 2009

A207974 Triangle related to A152198.

Original entry on oeis.org

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

Views

Author

Philippe Deléham, Feb 22 2012

Keywords

Comments

Row sums are A027383(n).
Diagonal sums are alternately A014739(n) and A001911(n+1).
The matrix inverse starts
1;
-1,1;
1,-2,1;
1,-1,-1,1;
-1,2,0,-2,1;
-1,1,2,-2,-1,1;
1,-2,-1,4,-1,-2,1;
1,-1,-3,3,3,-3,-1,1;
-1,2,2,-6,0,6,-2,-2,1;
-1,1,4,-4,-6,6,4,-4,-1,1;
1,-2,-3,8,2,-12,2,8,-3,-2,1;
apparently related to A158854. - R. J. Mathar, Apr 08 2013
From Gheorghe Coserea, Jun 11 2016: (Start)
T(n,k) is the number of terms of the sequence A057890 in the interval [2^n,2^(n+1)-1] having binary weight k+1.
T(n,k) = A007318(n,k) (mod 2) and the number of odd terms in row n of the triangle is 2^A000120(n).
(End)

Examples

			Triangle begins :
n\k  [0] [1] [2] [3] [4] [5] [6] [7] [8] [9]
[0]  1;
[1]  1,  1;
[2]  1,  2,  1;
[3]  1,  3,  1,  1;
[4]  1,  4,  2,  2,  1;
[5]  1,  5,  2,  4,  1,  1;
[6]  1,  6,  3,  6,  3,  2,  1;
[7]  1,  7,  3,  9,  3,  5,  1,  1;
[8]  1,  8,  4,  12, 6,  8,  4,  2,  1;
[9]  1,  9,  4,  16, 6,  14, 4,  6,  1,  1;
[10] ...
		

Crossrefs

Cf. Diagonals : A000012, A000034, A052938, A097362
Related to thickness: A000120, A027383, A057890, A274036.

Programs

  • Maple
    A207974 := proc(n,k)
        if k = 0 then
            1;
        elif k < 0 or k > n then
            0 ;
        else
            procname(n-1,k-1)-(-1)^k*procname(n-1,k) ;
        end if;
    end proc: # R. J. Mathar, Apr 08 2013
  • PARI
    seq(N) = {
      my(t = vector(N+1, n, vector(n, k, k==1 || k == n)));
      for(n = 2, N+1, for (k = 2, n-1,
          t[n][k] = t[n-1][k-1] + (-1)^(k%2)*t[n-1][k]));
      return(t);
    };
    concat(seq(10))  \\ Gheorghe Coserea, Jun 09 2016
    
  • PARI
    P(n) = ((2+x+(n%2)*x^2) * (1+x^2)^(n\2) - 2)/x;
    concat(vector(11, n, Vecrev(P(n-1)))) \\ Gheorghe Coserea, Mar 14 2017

Formula

T(n,k) = T(n-1,k-1) - (-1)^k*T(n-1,k), k>0 ; T(n,0) = 1.
T(2n,2k) = T(2n+1,2k) = binomial(n,k) = A007318(n,k).
T(2n+1,2k+1) = A110813(n,k).
T(2n+2,2k+1) = 2*A135278(n,k).
T(n,2k) + T(n,2k+1) = A152201(n,k).
T(n,2k) = A152198(n,k).
T(n+1,2k+1) = A152201(n,k).
T(n,k) = T(n-2,k-2) + T(n-2,k).
T(2n,n) = A128014(n+1).
T(n,k) = card {p, 2^n <= A057890(p) <= 2^(n+1)-1 and A000120(A057890(p)) = k+1}. - Gheorghe Coserea, Jun 09 2016
P_n(x) = Sum_{k=0..n} T(n,k)*x^k = ((2+x+(n mod 2)*x^2)*(1+x^2)^(n\2) - 2)/x. - Gheorghe Coserea, Mar 14 2017
Previous Showing 11-20 of 29 results. Next