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

A124349 Numbers of directed Hamiltonian cycles on the n-prism graph.

Original entry on oeis.org

6, 12, 10, 16, 14, 20, 18, 24, 22, 28, 26, 32, 30, 36, 34, 40, 38, 44, 42, 48, 46, 52, 50, 56, 54, 60, 58, 64, 62, 68, 66, 72, 70, 76, 74, 80, 78, 84, 82, 88, 86, 92, 90, 96, 94, 100, 98, 104, 102, 108, 106, 112, 110, 116, 114, 120, 118, 124, 122, 128, 126, 132, 130
Offset: 3

Views

Author

Eric W. Weisstein, Oct 26 2006

Keywords

Crossrefs

Programs

  • Magma
    [2*n+(1-(n mod 2))*4: n in [3..80]]; // Vincenzo Librandi, Jan 26 2016
    
  • Maple
    seq( 2*n + (1-(n mod 2))*4, n=3..100); # Robert Israel, Mar 14 2016
  • Mathematica
    Table[2 n + (1 - Mod[n, 2]) 4, {n, 3, 100}] (* Vincenzo Librandi, Jan 26 2016 *)
  • PARI
    Vec(2*x^3*(3+3*x-4*x^2)/((1-x)^2*(1+x)) + O(x^100)) \\ Altug Alkan, Mar 14 2016

Formula

a(n) = 2*n + (1-(n mod 2))*4.
From Colin Barker, Aug 22 2012: (Start)
a(n) = a(n-1)+a(n-2)-a(n-3).
G.f.: 2*x^3*(3+3*x-4*x^2)/((1-x)^2*(1+x)). (End)
a(n) = 2*A014681(n+1). - R. J. Mathar, Jan 25 2016
E.g.f.: 2*(2 + x)*cosh(x) + 2*x*sinh(x) - 2*(2 + x + 2*x^2). - Stefano Spezia, Jan 28 2024

Extensions

Name clarified by Andrew Howroyd, Mar 14 2016

A162853 Take the binary representation of n. Reduce by one digit every run (completely of either 0's or 1's) of an even number of digits. Increase by one digit every run of an odd number of digits in the binary representation of n (where this added digit has the same value that makes up the rest of the run's digits). a(n) = the decimal equivalent of the result.

Original entry on oeis.org

0, 3, 12, 1, 6, 51, 4, 15, 48, 27, 204, 25, 2, 19, 60, 7, 24, 195, 108, 13, 102, 819, 100, 207, 16, 11, 76, 9, 30, 243, 28, 63, 192, 99, 780, 97, 54, 435, 52, 111, 816, 411, 3276, 409, 50, 403, 828, 103, 8, 67, 44, 5, 38, 307, 36, 79, 240, 123, 972, 121, 14, 115, 252, 31, 96
Offset: 0

Views

Author

Leroy Quet, Jul 14 2009

Keywords

Comments

This is a self-inverse permutation of the nonnegative integers.
Clarification: The consecutive "runs" (mentioned in the definition) alternate between those completely of 1's and those completely of 0's.
In the binary representation of n, replace each run of length r by a run of length A014681(r). - Rémy Sigrist, Oct 09 2018

Examples

			152 in binary is 10011000. There is a run of one 1, followed by a run of two 0's, followed by a run of two 1's, followed by a run of three 0's. We reduce the two runs of two digits each to one digit; and we add a digit (a 1) to the first run of one 1, and a digit (a 0) to the last run of three 0's, to get 11010000. So a(152) is the decimal equivalent of this, which is 208.
		

Crossrefs

Programs

  • Maple
    rerun := proc(L) if nops(L) mod 2 = 0 then subsop(1=NULL,L) ; else [op(L),op(1,L)] ; fi; end: Lton := proc(L) local i; add( op(i,L)*2^(i-1),i=1..nops(L)) ; end: A162853 := proc(n) local strt,en,L,dgs,i; strt := 1; en := -1; L := [] ; dgs := convert(n,base,2) ; for i from 2 to nops(dgs) do if op(i,dgs) <> op(i-1,dgs) then en := i-1 ; L := [op(L), op(rerun([op(strt..en,dgs)])) ] ; strt := i; fi; od: en := nops(dgs) ; L := [op(L), op(rerun([op(strt..en,dgs)])) ] ; Lton(L) ; end: seq(A162853(n),n=1..100) ; # R. J. Mathar, Aug 01 2009
  • Mathematica
    Table[FromDigits[Flatten[If[OddQ[Length[#]],Join[{First[#]},#],Drop[#,1]]& /@Split[ IntegerDigits[ n,2]]], 2],{n,70}] (* Harvey P. Dale, Jun 20 2011 *)
  • PARI
    a(n) = if (n==0, 0, my (b=n%2, r=valuation(n+b,2), rr=if (r%2, r+1, r-1)); (a(n\2^r)+b)*2^rr-b) \\ Rémy Sigrist, Oct 09 2018

Formula

a(n) = A266150(A266151(n)) = A266151(A266150(n)) for any n > 0. - Rémy Sigrist, Oct 09 2018

Extensions

Extended beyond a(13) by R. J. Mathar, Aug 01 2009
a(0) added by Rémy Sigrist, Oct 09 2018

A163543 The relative direction (0=straight ahead, 1=turn right, 2=turn left) taken by the type I Hilbert's Hamiltonian walk A163359 at the step n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 01 2009

Keywords

Comments

a(16*n) = a(256*n) for all n.

Crossrefs

a(n) = A014681(A163542(n)). See also A163541.

Programs

  • Mathematica
    HC = {
    L[n_ /; IntegerQ[n/2]] :> {F[n], L[n], L[n + 1], R[n + 2]},
    R[n_ /; IntegerQ[(n + 1)/2]] :> {F[n], R[n], R[n + 3], L[n + 2]},
    R[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], F[n + 3]},
    L[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], F[n + 1]},
    F[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], L[n + 3]},
    F[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], R[n + 1]}};
    a[1] = F[0]; Map[(a[n_ /; IntegerQ[(n - #)/16] ] := Part[Flatten[a[(n + 16 - #)/16] /. HC /. HC],#]) &, Range[16]];
    Part[a[#] & /@ Range[4^4] /. {L[] -> 2, R[] -> 1, F[] -> 0}, 2 ;; -1] (* _Bradley Klee, Aug 06 2015 *)
  • Scheme
    (define (A163543 n) (A163241 (modulo (- (A163541 (1+ n)) (A163541 n)) 4)))

Formula

a(n) = A163241((A163541(n+1)-A163541(n)) modulo 4).

A061800 a(n) = n + (-1)^(n mod 3).

Original entry on oeis.org

1, 0, 3, 4, 3, 6, 7, 6, 9, 10, 9, 12, 13, 12, 15, 16, 15, 18, 19, 18, 21, 22, 21, 24, 25, 24, 27, 28, 27, 30, 31, 30, 33, 34, 33, 36, 37, 36, 39, 40, 39, 42, 43, 42, 45, 46, 45, 48, 49, 48, 51, 52, 51, 54, 55, 54, 57, 58, 57, 60, 61, 60, 63, 64, 63, 66, 67, 66, 69, 70, 69, 72
Offset: 0

Views

Author

Olivier Gérard, Jun 22 2001

Keywords

Comments

The arithmetic function v_3(n,1) as defined in A289187. - Robert Price, Aug 22 2017; corrected by Ridouane Oudra, Dec 28 2024

Examples

			a(4) = 4 + (-1)^1 = 3.
		

Crossrefs

Programs

Formula

O.g.f.: (1-x+3*x^2)/((-1+x)^2*(1+x+x^2)). - R. J. Mathar, Apr 02 2008
a(n) = (3*n + 1 - 4*cos(2*(n+2)*Pi/3))/3. - Wesley Ivan Hurt, Sep 26 2017
a(n) = a(n-1) + a(n-3) - a(n-4) for n > 3. - Wesley Ivan Hurt, Oct 07 2017
a(n) = n + 2 - gcd(n+2,3). - Ridouane Oudra, Dec 28 2024
Sum_{n>=2} (-1)^n/a(n) = Pi/(3*sqrt(3)) + log(2) - 1. - Amiram Eldar, Jan 15 2025

A065168 Permutation t->t-1 of Z, folded to N.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 19 2001

Keywords

Comments

This permutation consists of just one cycle, which is infinite.

Crossrefs

Inverse permutation to A065164.
Obtained by composing permutations A065190 and A014681.

Programs

  • Maple
    a:= n-> n-2*(-1)^n +`if`(n=2, 1, 0):
    seq(a(n), n=1..80); # Alois P. Heinz, Mar 07 2012
  • Mathematica
    Join[{3, 1}, LinearRecurrence[{1, 1, -1}, {5, 2, 7}, 100]] (* Jean-François Alcover, Feb 28 2016 *)

Formula

Let f: Z -> N be given by f(z) = 2z if z>0 else 2|z|+1, with inverse g(z) = z/2 if z even else (1-z)/2. Then a(n) = f(g(n)-1).
G.f.: x*(3-2*x+x^4+x^2-x^3) / ((x+1)*(x-1)^2). - Alois P. Heinz, Mar 07 2012
Sum_{n>=1} (-1)^n/a(n) = 2 - log(2). - Amiram Eldar, Aug 08 2023

A086970 Fix 1, then exchange the subsequent odd numbers in pairs.

Original entry on oeis.org

1, 5, 3, 9, 7, 13, 11, 17, 15, 21, 19, 25, 23, 29, 27, 33, 31, 37, 35, 41, 39, 45, 43, 49, 47, 53, 51, 57, 55, 61, 59, 65, 63, 69, 67, 73, 71, 77, 75, 81, 79, 85, 83, 89, 87, 93, 91, 97, 95, 101, 99, 105, 103, 109, 107, 113, 111, 117, 115, 121, 119
Offset: 0

Views

Author

Paul Barry, Jul 26 2003

Keywords

Comments

Partial sums are A086955.

Crossrefs

Programs

  • Magma
    [1] cat [2*n+1-2*(-1)^n: n in [1..70]]; // Vincenzo Librandi, Jun 21 2017
    
  • Mathematica
    Join[{1}, LinearRecurrence[{1, 1, -1}, {5, 3, 9}, 60]] (* Vincenzo Librandi, Jun 21 2017 *)
  • PARI
    Vec((1+4*x-3*x^2+2*x^3)/((1+x)*(1-x)^2) + O(x^100)) \\ Michel Marcus, Jun 21 2017

Formula

G.f.: (1+4*x-3*x^2+2*x^3)/((1+x)*(1-x)^2).
a(n) = n + abs(2 - (n + 1)*(-1)^n). - Lechoslaw Ratajczak, Dec 09 2016
a(n) = 2*A065190(n+1)-1 and a(n) = 2*A014681(n)+1. - Michel Marcus, Dec 10 2016
From Guenther Schrack, Jun 09 2017: (Start)
a(n) = 2*n + 1 - 2*(-1)^n for n > 0.
a(n) = 2*n + 1 - 2*cos(n*Pi) for n > 0.
a(n) = 4*n - a(n-1) for n > 1.
Linear recurrence: a(n) = a(n-1) + a(n-2) - a(n-3) for n > 3.
First differences: 2 - 4*(-1)^n for n > 1; -(-1)^n*A010696(n) for n > 1.
a(n) = A065164(n+1) + n for n > 0.
a(A014681(n)) = A005408(n) for n >= 0.
a(A005408(A014681(n)) for n >= 0.
a(n) = A005408(A103889(n)) for n >= 0.
A103889(a(n)) = 2*A065190(n+1) for n >= 0.
a(2*n-1) = A004766(n) for n > 0.
a(2*n+2) = A004767(n) for n >= 0. (End)

A124356 Number of (directed) Hamiltonian cycles on the Moebius ladder graph M_n (for n>=4).

Original entry on oeis.org

2, 8, 6, 12, 10, 16, 14, 20, 18, 24, 22, 28, 26, 32, 30, 36, 34, 40, 38, 44, 42, 48, 46, 52, 50, 56, 54, 60, 58, 64, 62, 68, 66, 72, 70, 76, 74, 80, 78, 84, 82, 88, 86, 92, 90, 96, 94, 100, 98, 104, 102, 108, 106, 112, 110, 116, 114, 120, 118, 124, 122, 128, 126, 132
Offset: 1

Views

Author

Eric W. Weisstein, Nov 05 2006

Keywords

Programs

Formula

a(n odd) = 2*n, a(n even) = 2*n+4.
a(n) = 2(n+1)+2(-1)^n. - Paul Barry, Feb 17 2008
a(n) -a(n-4) = 8. - Paul Curtz, Apr 19 2011
a(n) = +1*a(n-1) +1*a(n-2) -1*a(n-3). - Joerg Arndt, Apr 22 2011
G.f.: 2*x*(1+3*x-2*x^2)/((1-x)^2*(1+x)). - Colin Barker, Jan 23 2012
a(n) = 2*A014681(n+1). - R. J. Mathar, Nov 27 2015

A135681 a(n)=n if n=1 or if n=prime. Otherwise, n=4 if n is even and n=1 if n is odd.

Original entry on oeis.org

1, 2, 3, 4, 5, 4, 7, 4, 1, 4, 11, 4, 13, 4, 1, 4, 17, 4, 19, 4, 1, 4, 23, 4, 1, 4, 1, 4, 29, 4, 31, 4, 1, 4, 1, 4, 37, 4, 1, 4, 41, 4, 43, 4, 1, 4, 47, 4, 1, 4, 1, 4, 53, 4, 1, 4, 1, 4, 59, 4, 61, 4, 1, 4, 1, 4, 67, 4, 1, 4, 71, 4, 73
Offset: 1

Views

Author

Mohammad K. Azarian, Dec 01 2007

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := If[PrimeQ[n] || n == 1, n, If[EvenQ[n], 4, 1] ]; Table[a[n], {n,1,25}] (* G. C. Greubel, Oct 26 2016 *)

A163537 The relative direction (0=straight ahead, 1=turn right, 2=turn left) of the Peano curve A163336 at point n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 01 2009

Keywords

Comments

a(9*n) = a(81*n) for all n.

Crossrefs

Cf. A163535 (direction), A163536 (transposed relative).

Programs

Formula

a(n) = A163241((A163535(n+1)-A163535(n)) modulo 4).
a(n) = A014681(A163536(n)).

Extensions

Name corrected by Kevin Ryde, Aug 29 2020

A263449 Permutation of the natural numbers: [4k+1, 4k+4, 4k+3, 4k+2, ...].

Original entry on oeis.org

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

Views

Author

Wesley Ivan Hurt, Oct 18 2015

Keywords

Comments

From Franklin T. Adams-Watters, Jul 13 2017: (Start)
For this to be a permutation, it should have offset one, not zero.
With offset 1, a(n) is the smallest positive integer == n (mod 2) with a(n) != a(n-1) + 1. (End)

Crossrefs

Programs

  • Magma
    [n+1+(1-(-1)^n)*(-1)^(n*(n-1) div 4) : n in [0..100]];
    
  • Magma
    /* By definition: */ &cat[[4*k+1,4*k+4,4*k+3,4*k+2]: k in [0..20]]; // Bruno Berselli, Oct 19 2015
    
  • Maple
    A263449:=n->n+1+(1-(-1)^n)*(-1)^(n*(n-1)/2): seq(A263449(n), n=0..100);
  • Mathematica
    Table[n + 1 + (1 - (-1)^n) (-1)^(n (n - 1)/2), {n, 0, 100}] (* or *) LinearRecurrence[{2,-2,2,-1}, {1, 4, 3, 2}, 70]
  • PARI
    Vec((1+2*x-3*x^2+2*x^3)/((x-1)^2*(1+x^2)) + O(x^100)) \\ Altug Alkan, Oct 19 2015
    
  • PARI
    a(n) = n+1+I*((-I)^n-I^n) \\ Colin Barker, Oct 27 2015

Formula

G.f.: (1+2*x-3*x^2+2*x^3)/((x-1)^2*(1+x^2)).
a(n) = 2*a(n-1)-2*a(n-2)+2*a(n-3)-a(n-4) for n>3.
a(n) = n+1+(1-(-1)^n)*(-1)^(n*(n-1)/2).
a(2n) = A005408(n), a(2n+1) = 2*A014681(n+1).
a(n) = n+1+i*((-i)^n-i^n), where i=sqrt(-1). - Colin Barker, Oct 27 2015
a(n) = 4*ceiling(n/4) - (n mod 4) + 1. - Wesley Ivan Hurt, Nov 07 2015
Sum_{n>=0} (-1)^n/a(n) = log(2) (A002162). - Amiram Eldar, Nov 28 2023
Previous Showing 11-20 of 28 results. Next