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-8 of 8 results.

A053985 Replace 2^k with (-2)^k in binary expansion of n.

Original entry on oeis.org

0, 1, -2, -1, 4, 5, 2, 3, -8, -7, -10, -9, -4, -3, -6, -5, 16, 17, 14, 15, 20, 21, 18, 19, 8, 9, 6, 7, 12, 13, 10, 11, -32, -31, -34, -33, -28, -27, -30, -29, -40, -39, -42, -41, -36, -35, -38, -37, -16, -15, -18, -17, -12, -11, -14, -13, -24, -23, -26, -25, -20, -19
Offset: 0

Views

Author

Henry Bottomley, Apr 03 2000

Keywords

Comments

Base 2 representation for n (in lexicographic order) converted from base -2 to base 10.
Maps natural numbers uniquely onto integers; within each group of positive values, maximum is in A002450; a(n)=n iff n can be written only with 1's and 0's in base 4 (A000695).
a(n) = A004514(n) - n. - Reinhard Zumkeller, Dec 27 2003
Schroeppel gives formula n = (a(n) + b) XOR b where b = binary ...101010, and notes this formula is reversible. The reverse a(n) = (n XOR b) - b is a bit twiddle to transform 1 bits to -1. Odd position 0 or 1 in n is flipped by "XOR b" to 1 or 0, then "- b" gives 0 or -1. Only odd position 1's are changed, so b can be any length sure to cover those. - Kevin Ryde, Jun 26 2020

Examples

			a(9)=-7 because 9 is written 1001 base 2 and (-2)^3 + (-2)^0 = -8 + 1 = -7.
Or by Schroeppel's formula, b = binary 1010 then a(9) = (1001 XOR 1010) - 1010 = decimal -7. - _Kevin Ryde_, Jun 26 2020
		

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 2]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 2]], {n, 1, 80}]; b
    (* Second program: *)
    Array[FromDigits[IntegerDigits[#, 2], -2] &, 62, 0] (* Michael De Vlieger, Jun 27 2020 *)
  • PARI
    a(n) = fromdigits(binary(n), -2) \\ Rémy Sigrist, Sep 01 2018
    
  • Python
    def A053985(n): return  -(b:=int('10'*(n.bit_length()+1>>1),2)) + (n^b) if n else 0 # Chai Wah Wu, Nov 18 2022

Formula

From Ralf Stephan, Jun 13 2003: (Start)
G.f.: (1/(1-x)) * Sum_{k>=0} (-2)^k*x^2^k/(1+x^2^k).
a(0) = 0, a(2*n) = -2*a(n), a(2*n+1) = -2*a(n)+1. (End)
a(n) = Sum_{k>=0} A030308(n,k)*A122803(k). - Philippe Deléham, Oct 15 2011
a(n) = (n XOR b) - b where b = binary ..101010 [Schroeppel]. Any b of this form (A020988) with bitlength(b) >= bitlength(n) suits. - Kevin Ryde, Jun 26 2020

A065369 Replace 3^k with (-3)^k in ternary expansion of n.

Original entry on oeis.org

0, 1, 2, -3, -2, -1, -6, -5, -4, 9, 10, 11, 6, 7, 8, 3, 4, 5, 18, 19, 20, 15, 16, 17, 12, 13, 14, -27, -26, -25, -30, -29, -28, -33, -32, -31, -18, -17, -16, -21, -20, -19, -24, -23, -22, -9, -8, -7, -12, -11, -10, -15, -14, -13, -54, -53, -52, -57, -56, -55, -60, -59, -58, -45, -44, -43, -48, -47, -46
Offset: 0

Views

Author

Marc LeBrun, Oct 31 2001

Keywords

Comments

Base 3 representation for n (in lexicographic order) converted from base -3 to base 10.
Notation: (3)[n](-3)
Fixed point of the morphism 0-> 0,1,2 ; 1-> -3,-2,-1 ; 2-> -6,-5,-4 ; ...; n-> -3n,-3n+1,-3n+2. - Philippe Deléham, Oct 22 2011

Examples

			15 = +1(9)+2(3)+0(1) -> +1(+9)+2(-3)+0(+1) = +3 = a(15)
		

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 3]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 3]], {n, 1, 80}]; b
  • PARI
    a(n) = fromdigits(digits(n, 3), -3) \\ Rémy Sigrist, Feb 06 2020

Formula

a(n) = Sum_{k>=0} A030341(n,k)*(-3)^k. - Philippe Deléham, Oct 22 2011
a(3*k+m) = -3*a(k)+m for 0 <= m < 3. - Chai Wah Wu, Jan 16 2020

A073835 Replace 10^k with (-10)^k in decimal expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -60
Offset: 0

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 10 representation for n (in lexicographic order) converted from base -10 to base 10.
A bijection from N = [0..oo) to Z = (-oo..+oo), or enumeration of the integers. - M. F. Hasler, Oct 17 2018

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[FromDigits[ IntegerDigits[n, 10]], {n, 0, 80}]; b = {}; Do[ b = Append[b, f[a[[n]], 10]], {n, 1, 80}]; b (* Typo fixed by Harvey P. Dale, Oct 03 2013 *)
  • PARI
    a(n)=fromdigits(digits(n),-10) \\ M. F. Hasler, Oct 17 2018

Formula

a(10*k+m) = -10*a(k)+m for 0 <= m < 10. - Chai Wah Wu, Jan 16 2020

A073791 Replace 4^k with (-4)^k in base 4 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, -4, -3, -2, -1, -8, -7, -6, -5, -12, -11, -10, -9, 16, 17, 18, 19, 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 32, 33, 34, 35, 28, 29, 30, 31, 24, 25, 26, 27, 20, 21, 22, 23, 48, 49, 50, 51, 44, 45, 46, 47, 40, 41, 42, 43, 36, 37, 38, 39, -64, -63, -62, -61, -68, -67, -66, -65, -72, -71, -70, -69
Offset: 0

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 4 representation for n converted from base -4 to base 10.

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 4]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 4]], {n, 1, 80}]; b
  • PARI
    a(n) = subst(Pol(digits(n,4)), x, -4); \\ Michel Marcus, Jan 30 2019

Formula

a(4*k+m) = -4*a(k)+m for 0 <= m < 4. - Chai Wah Wu, Jan 16 2020

A073794 Replace 7^k with (-7)^k in base 7 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, -7, -6, -5, -4, -3, -2, -1, -14, -13, -12, -11, -10, -9, -8, -21, -20, -19, -18, -17, -16, -15, -28, -27, -26, -25, -24, -23, -22, -35, -34, -33, -32, -31, -30, -29, -42, -41, -40, -39, -38, -37, -36, 49, 50, 51, 52, 53, 54, 55, 42, 43, 44, 45, 46, 47, 48, 35, 36, 37, 38, 39, 40, 41
Offset: 0

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 7 representation for n (in lexicographic order) converted from base -7 to base 10.

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 7]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 7]], {n, 1, 80}]; b

Formula

a(7*k+m) = -7*a(k)+m for 0 <= m < 7. - Chai Wah Wu, Jan 16 2020

A073792 Replace 5^k with (-5)^k in base 5 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, -5, -4, -3, -2, -1, -10, -9, -8, -7, -6, -15, -14, -13, -12, -11, -20, -19, -18, -17, -16, 25, 26, 27, 28, 29, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 50, 51, 52, 53, 54, 45, 46, 47, 48, 49, 40, 41, 42, 43, 44, 35, 36, 37, 38, 39, 30, 31, 32, 33, 34
Offset: 0

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 5 representation for n converted from base -5 to base 10.

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 5]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 5]], {n, 1, 80}]; b

Formula

a(5*k+m) = -5*a(k)+m for 0 <= m < 5. - Chai Wah Wu, Jan 16 2020

A073793 Replace 6^k with (-6)^k in base 6 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, -6, -5, -4, -3, -2, -1, -12, -11, -10, -9, -8, -7, -18, -17, -16, -15, -14, -13, -24, -23, -22, -21, -20, -19, -30, -29, -28, -27, -26, -25, 36, 37, 38, 39, 40, 41, 30, 31, 32, 33, 34, 35, 24, 25, 26, 27, 28, 29, 18, 19, 20, 21, 22, 23, 12, 13, 14, 15, 16, 17, 6, 7, 8, 9, 10, 11
Offset: 0

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 6 representation for n converted from base -6 to base 10.

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 6]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 6]], {n, 1, 80}]; b

Formula

a(6*k+m) = -6*a(k)+m for 0 <= m < 6. - Chai Wah Wu, Jan 16 2020

A073796 Replace 9^k with (-9)^k in base 9 expansion of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, -9, -8, -7, -6, -5, -4, -3, -2, -1, -18, -17, -16, -15, -14, -13, -12, -11, -10, -27, -26, -25, -24, -23, -22, -21, -20, -19, -36, -35, -34, -33, -32, -31, -30, -29, -28, -45, -44, -43, -42, -41, -40, -39, -38, -37, -54, -53, -52, -51, -50, -49, -48, -47, -46
Offset: 0

Views

Author

Robert G. Wilson v, Aug 12 2002

Keywords

Comments

Base 9 representation for n (in lexicographic order) converted from base -9 to base 10.

Crossrefs

Programs

  • Mathematica
    f[n_Integer, b_Integer] := Block[{l = IntegerDigits[n]}, Sum[l[[ -i]]*(-b)^(i - 1), {i, 1, Length[l]}]]; a = Table[ FromDigits[ IntegerDigits[n, 9]], {n, 0, 80}]; b = {}; Do[b = Append[b, f[a[[n]], 9]], {n, 1, 80}]; b

Formula

a(9*k+m) = -9*a(k)+m for 0 <= m < 9. - Chai Wah Wu, Jan 16 2020
Showing 1-8 of 8 results.