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

A338248 Nonnegative values in A053985, in order of appearance.

Original entry on oeis.org

0, 1, 4, 5, 2, 3, 16, 17, 14, 15, 20, 21, 18, 19, 8, 9, 6, 7, 12, 13, 10, 11, 64, 65, 62, 63, 68, 69, 66, 67, 56, 57, 54, 55, 60, 61, 58, 59, 80, 81, 78, 79, 84, 85, 82, 83, 72, 73, 70, 71, 76, 77, 74, 75, 32, 33, 30, 31, 36, 37, 34, 35, 24, 25, 22, 23, 28, 29
Offset: 0

Views

Author

Rémy Sigrist, Oct 18 2020

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers (the offset has been set to 0 so as to get a permutation).
There are only two fixed points: a(0) = 0 and a(1) = 1.

Examples

			A053985 = 0, 1, -2, -1, 4, 5, 2, 3, -8, -7, -10, -9, -4, -3, -6, -5, 16, 17, ...
We keep:  0, 1,         4, 5, 2, 3,                                  16, 17, ...
		

Crossrefs

See A338245 for a similar sequence.

Programs

  • PARI
    A053985(n) = fromdigits(binary(n), -2)
    print (select(v -> v>=0, apply(A053985, [0..109])))

Formula

a(0) = 0.
a(n) = A053985(A053738(n)) for any n > 0.

A338249 Nonpositive values in A053985, in order of appearance and negated.

Original entry on oeis.org

0, 2, 1, 8, 7, 10, 9, 4, 3, 6, 5, 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, 22, 21, 128, 127, 130, 129, 124, 123, 126, 125, 136, 135, 138, 137, 132, 131, 134, 133, 112, 111, 114, 113
Offset: 0

Views

Author

Rémy Sigrist, Oct 18 2020

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers (the offset has been set to 0 so as to get a permutation).
There is only one fixed point: a(0) = 0.

Examples

			A053985 = 0, 1, -2, -1, 4, 5, 2, 3, -8, -7, -10, -9, -4, -3, -6, -5, ...
We keep:  0,     2,  1,              8,  7,  10,  9,  4,  3,  6,  5, ...
		

Crossrefs

Programs

  • PARI
    A053985(n) = fromdigits(binary(n), -2)
    print (-select(v -> v<=0, apply(A053985, [0..147])))

Formula

a(n) = -A053985(A053754(n+1)) for any n >= 0.

A331206 Numbers k such that A053985(k) divides k.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 17, 20, 21, 24, 30, 32, 34, 40, 42, 48, 51, 60, 63, 64, 65, 68, 69, 80, 81, 84, 85, 96, 102, 120, 126, 128, 130, 136, 138, 160, 162, 168, 170, 192, 195, 204, 207, 240, 243, 252, 255, 256, 257, 260, 261, 272, 273, 276, 277
Offset: 1

Views

Author

Alon Ran, Jan 12 2020

Keywords

Comments

It appears that A053985(a(n)) / a(n) is always either 1, -1, 3 or -3.
This sequence seems to contain A329000.

Examples

			15 is written 1111 base 2 and (-2)^3 + (-2)^2 + (-2)^1 +(-2)^0 = -8 + 4 - 2 + 1 = -5, 15 is divisible by -5.
		

Programs

  • PARI
    is(k) = k%fromdigits(binary(k), -2) == 0; \\ Jinyuan Wang, Jan 15 2020

A057300 Binary counter with odd/even bit positions swapped; base-4 counter with 1's replaced by 2's and vice versa.

Original entry on oeis.org

0, 2, 1, 3, 8, 10, 9, 11, 4, 6, 5, 7, 12, 14, 13, 15, 32, 34, 33, 35, 40, 42, 41, 43, 36, 38, 37, 39, 44, 46, 45, 47, 16, 18, 17, 19, 24, 26, 25, 27, 20, 22, 21, 23, 28, 30, 29, 31, 48, 50, 49, 51, 56, 58, 57, 59, 52, 54, 53, 55, 60, 62, 61, 63, 128, 130, 129, 131, 136, 138
Offset: 0

Views

Author

Marc LeBrun, Aug 24 2000

Keywords

Comments

A self-inverse permutation of the integers.
a(n) = n if and only if n can be written as 3*Sum_{k>=0} d_i*4^k, where d_i is either 0 or 1. - Jon Perry, Oct 06 2012
From Veselin Jungic, Mar 03 2015: (Start)
In 1988 A. F. Sidorenko, see the Sidorenko reference, used this sequence as an example of a permutation of the set of positive integers with the property that if positive integers i, j, and k form a 3-term arithmetic progression then the corresponding terms a(i), a(j), and a(k) do not form an arithmetic progression.
In the terminology introduced in the Brown, Jungic, and Poelstra reference, the sequence does not contain "double 3-term arithmetic progressions".
It is not difficult to check that this sequence is with unbounded gaps, i.e., for any positive number m there is a natural number n such that a(n+1) - a(n) > m.
It is an open question if every sequence of integers with bounded gaps must contain a double 3-term arithmetic progression. This problem is equivalent to the well known additive square problem in infinite words: Is it true that any infinite word with a finite set of integers as its alphabet contains two consecutive blocks of the same length and the same sum? For more details about the additive square problem in infinite words see the following references: Ardal, et al.; Brown and Freedman; Freedman; Grytczuk; Halbeisen and Hungerbuhler, and Pirillo and Varricchio.
The sequence was attributed to Sidorenko in P. Hegarty's paper "Permutations avoiding arithmetic patterns". In his paper Hegarty characterized the countably infinite abelian groups for which there exists a bijection mapping arithmetic progressions to non-arithmetic progressions. This was further generalized by Jungic and Sahasrabudhe. (End)

Examples

			a(31) = a(4*7+3) = 4*a(7) + a(3) = 4*11 + 3 = 47.
		

Crossrefs

Sequences used in definitions of this sequence: A000695, A059905, A059906.
Sequences with similar definitions: A057301, A126006, A126007, A126008, A163241, A163327.
A003986, A003987, A004198, A053985, A054240 are used to express relationships between sequence terms.

Programs

  • C
    #include 
    uint32_t a(uint32_t n) { return ((n & 0x55555555) << 1) | ((n & 0xaaaaaaaa) >> 1); } /* Falk Hüffner, Jan 23 2022 */
  • Maple
    a:= proc(n) option remember; `if`(n=0, 0,
          a(iquo(n, 4, 'r'))*4+[0, 2, 1, 3][r+1])
        end:
    seq(a(n), n=0..69);  # Alois P. Heinz, Jan 25 2022
  • Mathematica
    Table[FromDigits[IntegerDigits[n,4]/.{1->2,2->1},4],{n,0,70}] (* Harvey P. Dale, Aug 24 2017 *)
  • PARI
    A057300(n) = { my(t=1,s=0); while(n>0, if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); }; \\ Antti Karttunen, Apr 14 2018
    

Formula

Conjecture: a(2*n) = -2*a(n) + 5*n, a(2*n+1) = -2*a(n) + 5*n + 2. - Ralf Stephan, Oct 11 2003
a(4n+k) = 4a(n) + a(k), 0 <= k <= 3. - Jon Perry, Oct 06 2012
a(n) = A000695(A059906(n)) + 2*A000695(A059905(n)). - Antti Karttunen, Apr 14 2018
From Peter Munn, Dec 10 2019: (Start)
a(a(n)) = n.
a(A000695(m) + 2*A000695(n)) = 2*A000695(m) + A000695(n).
a(n OR k) = a(n) OR a(k), where OR is bitwise-or (A003986).
a(n XOR k) = a(n) XOR a(k), where XOR is bitwise exclusive-or (A003987).
a(n AND k) = a(n) AND a(k), where AND is bitwise-and (A004198).
a(A054240(n,k)) = A054240(a(n), a(k)). (End)
a(n) = 5*n/4 - 3*A053985(2*n)/8. - Alan Michael Gómez Calderón, May 20 2025

A005351 Base -2 representation for n regarded as base 2, then evaluated.

Original entry on oeis.org

0, 1, 6, 7, 4, 5, 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106, 107, 104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 123, 120, 121, 126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 74, 75, 72, 73, 78, 79, 76
Offset: 0

Views

Author

Keywords

Comments

a(n) = n when n is a power of 4. This is because the even-indexed powers of 2 are the same as the even-indexed powers of -2. - Alonso del Arte, Feb 09 2012
a(n) = n if n is a sum of distinct powers of 4. - Michael Somos, Aug 27 2012
Write n = Sum_{i in b(n)} (-2)^(i - 1), which uniquely determines the set of positive integers b(n). Then a(n) = Sum_{i in b(n)} 2^(i - 1). For example, a(7) = 27 because 7 = (-2)^0 + (-2)^1 + (-2)^3 + (-2)^4 and 27 = 2^0 + 2^1 + 2^3 + 2^4. - Gus Wiseman, Jul 26 2019

Examples

			2 = 4+(-2)+0 = 110 => 6, 3 = 4+(-2)+1 = 111 => 7, ..., 6 = (16)+(-8)+0+(-2)+0 = 11010 => 26.
		

References

  • M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 101.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A039724. Complement of A005352.
Cf. A185269 (primes in this sequence).

Programs

  • Haskell
    a005351 0 = 0
    a005351 n = a005351 n' * 2 + m where
       (n', m) = if r < 0 then (q + 1, r + 2) else (q, r)
                 where (q, r) = quotRem n (negate 2)
    -- Reinhard Zumkeller, Jul 07 2012
    
  • Mathematica
    a[n_] := Module[{t = 2(4^Floor[ Log[4, Abs[n] + 1] + 2] - 1)/3}, BitXor[n + t, t]]; Table[a[n], {n, 0, 60}] (* Robert G. Wilson v, Jan 24 2005 *)
  • PARI
    a(n) = my(t=(32*4^logint(abs(n)+1,4)-2)/3); bitxor(n+t,t); \\ Ruud H.G. van Tol, Oct 18 2023
  • Python
    def A005351(n):
        s, q = '', n
        while q >= 2 or q < 0:
            q, r = divmod(q, -2)
            if r < 0:
                q += 1
                r += 2
            s += str(r)
        return int(str(q)+s[::-1],2) # Chai Wah Wu, Apr 10 2016
    

Formula

a(4n+2) = 4a(n+1)+2, a(4n+3) = 4a(n+1)+3, a(4n+4) = 4a(n+1), a(4n+5) = 4a(n+1)+1, n>-2, a(1)=1. - Ralf Stephan, Apr 06 2004

Extensions

More terms from Robert G. Wilson v, Jan 24 2005

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
Showing 1-10 of 23 results. Next