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

A201629 a(n) = n if n is even and otherwise its nearest multiple of 4.

Original entry on oeis.org

0, 0, 2, 4, 4, 4, 6, 8, 8, 8, 10, 12, 12, 12, 14, 16, 16, 16, 18, 20, 20, 20, 22, 24, 24, 24, 26, 28, 28, 28, 30, 32, 32, 32, 34, 36, 36, 36, 38, 40, 40, 40, 42, 44, 44, 44, 46, 48, 48, 48, 50, 52, 52, 52, 54, 56, 56, 56, 58, 60, 60, 60, 62, 64, 64, 64, 66, 68, 68
Offset: 0

Views

Author

Vaclav Kotesovec, Dec 03 2011

Keywords

Comments

For n > 1, the maximal number of nonattacking knights on a 2 x (n-1) chessboard.
Compare this with the binary triangle construction of A240828.
Minimal number of straight segments in a rook circuit of an (n-1) X n board (see example). - Ruediger Jehn, Feb 26 2021

Examples

			G.f. = 2*x^2 + 4*x^3 + 4*x^4 + 4*x^5 + 6*x^6 + 8*x^7 + 8*x^8 + 8*x^9 + ...
From _Ruediger Jehn_, Feb 26 2021: (Start)
a(5) = 4:
   +----+----+----+----+----+
   |  __|____|_   |   _|__  |
   | /  |    | \  |  / |  \ |
   +----+----+----+----+----+
   | \__|__  | |  |  | |  | |
   |    |  \ | \__|__/ |  | |
   +----+----+----+----+----+
   |  __|__/ |  __|__  |  | |
   | /  |    | /  |  \ |  | |
   +----+----+----+----+----+
   | \  |    | |  |  | |  | |
   |  \_|____|_/  |  \_|__/ |
   +----+----+----+----+----+
There are at least 4 squares on the 4 X 5 board with straight lines (here in squares a_12, a_25, a_35 and a_42).  (End)
		

Crossrefs

Programs

  • Haskell
    a201629 = (* 2) . a004524 . (+ 1) -- Reinhard Zumkeller, Aug 05 2014
    
  • Magma
    m:=50; R:=PowerSeriesRing(Integers(), m); Coefficients(R!(2*x^2/((1-x)^2*(1+x^2)))); // G. C. Greubel, Aug 13 2018
  • Maple
    seq(n-sin(Pi*n/2), n=0..30); # Robert Israel, Jul 14 2015
  • Mathematica
    Table[2*(Floor[(Floor[(n + 1)/2] + 1)/2] + Floor[(Floor[n/2] + 1)/2]), {n, 1, 100}]
    Table[If[EvenQ[n], n, 4*Round[n/4]], {n, 0, 68}] (* Alonso del Arte, Jan 27 2012 *)
    CoefficientList[Series[2 x^2/((-1 + x)^2 (1 + x^2)), {x, 0, 100}], x] (* Vincenzo Librandi, Aug 06 2014 *)
    a[ n_] := n - KroneckerSymbol[ -4, n]; (* Michael Somos, Jul 18 2015 *)
  • PARI
    a(n)=n\4*4+[0, 0, 2, 4][n%4+1] \\ Charles R Greathouse IV, Jan 27 2012
    
  • PARI
    {a(n) = n - kronecker( -4, n)}; /* Michael Somos, Jul 18 2015 */
    

Formula

a(n) = n - sin(n*Pi/2).
G.f.: 2*x^2/((1-x)^2*(1+x^2)).
a(n) = 2*A004524(n+1). - R. J. Mathar, Feb 02 2012
a(n) = n+(1-(-1)^n)*(-1)^((n+1)/2)/2. - Bruno Berselli, Aug 06 2014
E.g.f.: x*exp(x) - sin(x). - G. C. Greubel, Aug 13 2018

Extensions

Formula corrected by Robert Israel, Jul 14 2015

A186421 Even numbers interleaved with repeated odd numbers.

Original entry on oeis.org

0, 1, 2, 1, 4, 3, 6, 3, 8, 5, 10, 5, 12, 7, 14, 7, 16, 9, 18, 9, 20, 11, 22, 11, 24, 13, 26, 13, 28, 15, 30, 15, 32, 17, 34, 17, 36, 19, 38, 19, 40, 21, 42, 21, 44, 23, 46, 23, 48, 25, 50, 25, 52, 27, 54, 27, 56, 29, 58, 29, 60, 31, 62, 31, 64, 33, 66, 33, 68, 35, 70, 35, 72, 37, 74, 37, 76, 39, 78, 39, 80, 41, 82, 41, 84, 43, 86, 43
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 21 2011

Keywords

Comments

A005843 interleaved with A109613.
Row sum of superimposed binary filled triangle. - Craig Knecht, Aug 07 2015

Examples

			A005843: 0   2   4   6   8   10   12   14   16   18   20    22
A109613:   1   1   3   3   5    5    7    7    9    9    11    11
this   : 0 1 2 1 4 3 6 3 8 5 10 5 12 7 14 7 16 9 18 9 20 11 22 ... .
		

Crossrefs

Cf. A186422 (first differences), A186423 (partial sums), A240828 (row sum of superimposed binary triangle).

Programs

  • Haskell
    a186421 n = a186421_list !! n
    a186421_list = interleave [0,2..] $ rep [1,3..] where
       interleave (x:xs) ys = x : interleave ys xs
       rep (x:xs) = x : x : rep xs
    
  • Magma
    [IsEven(n) select n else 2*Floor(n/4)+1: n in [0..100]]; // Vincenzo Librandi, Jul 13 2015
    
  • Maple
    A186421:=n->n-(1-(-1)^n)*(n+(-1)^(n*(n+1)/2))/4: seq(A186421(n), n=0..100); # Wesley Ivan Hurt, Aug 07 2015
  • Mathematica
    Table[n - (1 - (-1)^n)*(n + I^(n (n + 1)))/4, {n, 0, 87}] (* or *)
    CoefficientList[Series[x (1 + 2 x + 2 x^3 + x^4)/((1 + x^2) (x - 1)^2 (1 + x)^2), {x, 0, 87}], x] (* or *)
    n = 88; Riffle[Range[0, n, 2], Flatten@ Transpose[{Range[1, n, 2], Range[1, n, 2]}]] (* Michael De Vlieger, Jul 14 2015 *)
  • Maxima
    makelist(n-(1-(-1)^n)*(n+%i^(n*(n+1)))/4, n, 0, 90); /* Bruno Berselli, Mar 04 2013 */
    
  • Python
    def A186421(n): return (n>>1)|1 if n&1 else n # Chai Wah Wu, Jan 31 2023

Formula

a(2*k) = 2*k, a(4*k+1) = a(4*k+3) = 2*k+1.
a(n) = n if n is even, else 2*floor(n/4)+1.
a(2*n-(2*k+1)) + a(2*n+2*k+1) = 2*n, 0 <= k < n.
a(n+2) = A109043(n) - a(n).
G.f.: x*(1+2*x+2*x^3+x^4) / ( (1+x^2)*(x-1)^2*(1+x)^2 ). - R. J. Mathar, Feb 23 2011
a(n) = n-(1-(-1)^n)*(n+i^(n(n+1)))/4, where i=sqrt(-1). - Bruno Berselli, Feb 23 2011
a(n) = a(n-2)+a(n-4)-a(n-6) for n>5. - Wesley Ivan Hurt, Aug 07 2015
E.g.f.: (x*cosh(x) + sin(x) + 2*x*sinh(x))/2. - Stefano Spezia, May 09 2021

Extensions

Edited by Bruno Berselli, Mar 04 2013

A240830 a(n)=1 for n <= s+k; thereafter a(n) = Sum(a(n-i-s-a(n-i-1)),i=0..k-1) where s=0, k=7.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 13, 13, 13, 13, 13, 13, 19, 13, 19, 19, 19, 19, 25, 19, 25, 19, 25, 25, 31, 25, 31, 25, 31, 25, 31, 31, 37, 31, 37, 31, 37, 37, 37, 37, 43, 37, 43, 43, 43, 43, 43, 43, 49, 49, 49, 49, 49, 49, 49, 55, 55, 55, 55, 55, 55, 61, 55, 61, 61, 61, 61, 67, 61, 67, 61, 67, 67, 73
Offset: 1

Views

Author

N. J. A. Sloane, Apr 16 2014

Keywords

Crossrefs

Same recurrence as A240828, A120503 and A046702.
See also A240831, A240832.
Callaghan et al. (2005)'s sequences T_{0,k}(n) for k=1 through 7 are A000012, A046699, A046702, A240835, A241154, A241155, A240830.

Programs

  • Maple
    #T_s,k(n) from Callaghan et al. Eq. (1.7).
    s:=0; k:=7;
    a:=proc(n) option remember; global s,k;
    if n <= s+k then 1
    else
        add(a(n-i-s-a(n-i-1)),i=0..k-1);
    fi; end;
    t1:=[seq(a(n),n=1..100)];
  • Mathematica
    A240830[n_]:=A240830[n]=If[n<=7,1,Sum[A240830[n-i-A240830[n-i-1]],{i,0,6}]];
    Array[A240830,100] (* Paolo Xausa, Dec 06 2023 *)

A185048 Length of the continued fraction for floor(Fibonacci(n)*(1+sqrt(5))/2) / Fibonacci(n).

Original entry on oeis.org

1, 1, 2, 2, 4, 2, 6, 4, 8, 4, 10, 6, 12, 6, 14, 8, 16, 8, 18, 10, 20, 10, 22, 12, 24, 12, 26, 14, 28, 14, 30, 16, 32, 16, 34, 18, 36, 18, 38, 20, 40, 20, 42, 22, 44, 22, 46, 24, 48, 24, 50, 26, 52, 26, 54, 28, 56, 28, 58, 30, 60, 30, 62, 32, 64, 32, 66, 34, 68, 34
Offset: 1

Views

Author

Benoit Cloitre, Feb 15 2011

Keywords

Comments

A240828 is an essentially identical sequence. - Bruno Berselli, Apr 18 2014

Crossrefs

Programs

  • Mathematica
    Table[Length[ContinuedFraction[Floor[Fibonacci[n]*GoldenRatio]/Fibonacci[n]]], {n, 70}]
  • PARI
    a(n)=if(n<3,1,if(n%2,n-1,2*floor(n/4)))

Formula

a(1)=a(2)=1, for k>=2 we have a(2k)=2*floor(k/2) and a(2k-1)=2*k-2.
G.f.: x*(x^7+x^6-x^5+x^4+x^3+x^2+x+1) / ((x-1)^2*(x+1)^2*(x^2+1)). - Colin Barker, Jun 20 2013

A240829 a(1)=-1, a(2)=0, a(3)=1; thereafter a(n) = Sum(a(n-i-s-a(n-i-1)),i=0..k-1) where s=0, k=3.

Original entry on oeis.org

-1, 0, 1, 3, 2, 4, 4, 7, 4, 7, 7, 9, 8, 9, 11, 10, 10, 13, 15, 13, 13, 13, 18, 15, 18, 18, 18, 18, 18, 23, 23, 20, 19, 23, 28, 27, 23, 25, 27, 28, 25, 26, 28, 30, 31, 32, 33, 33, 32, 34, 33, 38, 36, 39, 34, 36, 36, 39, 39, 39, 39, 44, 46, 46, 43, 46, 46, 44, 44, 49, 49, 49, 46, 51, 48, 51, 51, 54, 54, 54, 54, 54
Offset: 1

Views

Author

N. J. A. Sloane, Apr 16 2014

Keywords

References

  • Callaghan, Joseph, John J. Chew III, and Stephen M. Tanny. "On the behavior of a family of meta-Fibonacci sequences." SIAM Journal on Discrete Mathematics 18.4 (2005): 794-824. See Fig. 1.7.

Crossrefs

Same recurrence as A240828, A120503 and A046702.

Programs

  • Maple
    #T_s,k(n) from Callaghan et al. Eq. (1.6).
    s:=0; k:=3;
    a:=proc(n) option remember; global s,k;
    if n <= 3 then n-2
    else
        add(a(n-i-s-a(n-i-1)),i=0..k-1);
    fi; end;
    t1:=[seq(a(n),n=1..100)];

A257857 Sequentially filled binary triangle rotated 180 degrees and then superimposed and added to the original triangle.

Original entry on oeis.org

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

Views

Author

Craig Knecht, Jul 12 2015

Keywords

Comments

The integers in the LINKS illustration hang like ornaments on a tree.

Examples

			Triangle T(n,k) begins:       Row sums
2;                                2
1,  1;                            2
0,  2,  0;                        2
1,  1,  1,  1;                    4
2,  0,  2,  0,  2;                6
1,  1,  1,  1,  1,  1;            6
0,  2,  0,  2,  0,  2,  0;        6
1,  1,  1,  1,  1,  1,  1,  1;    8
		

Crossrefs

For row sums for the three other variations of this build process, see A186421, A201629, A240828.

Programs

  • Maple
    A257857 := proc(n,k)
        if type(n,'even') then
            1 ;
        elif type((n+1)/2+k,'even') then
            2 ;
        else
            0;
        end if;
    end proc:

Formula

T(n,k)=1 if n even, 1<=k<=n.
T(n,k)=2 if n odd and (n+1)/2+k even, 1<=k<=n.
T(n,k)=0 if n odd and (n+1)/2+k odd, 1<=k<=n.
Showing 1-6 of 6 results.