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.

A053616 Pyramidal sequence: distance to nearest triangular number.

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 20 2000

Keywords

Comments

From Wolfdieter Lang, Oct 24 2020: (Start)
If this sequence is written with offset 1 as a number triangle T(n, k), with n the length of row n, for n >= 1, then row n gives the primitive period of the periodic sequence {k (mod* n)}_{k>=0}, where k (mod* n) = k (mod n) if k <= floor(n/2) and otherwise it is -k (mod n). Such a modified modular relation mod* n has been used by Brändli and Beyne, but for integers relative prime to n.
These periodic sequences are given in A000007, A000035, A011655, A007877, |A117444|, A260686, A279316, for n = 1, 2, ..., 7. For n = 10 A271751, n = 12 A271832, n = 14 A279313. (End)

Examples

			a(12) = |12 - 10| = 2 since 10 is the nearest triangular number to 12.
From _M. F. Hasler_, Dec 06 2019: (Start)
Ignoring a(0) = 0, the sequence can be written as triangle indexed by m >= k >= 1, in which case the terms are (m - |k - |m-k||)/2, as follows:
   0,      (Row 0: ignore)
   0,      (Row m=1, k=1: For k=m, m - |k - |m-k|| = m - |m - 0| = 0.)
   1, 0,        (Row m=2: for k=1, |m-k| = 1, k-|m-k| = 0, m-0 = 2, (...)/2 = 1.)
   1, 1, 0,
   1, 2, 1, 0,    (Row m=4: for k=2, we have twice the value of (m=2, k=1) => 2.)
   1, 2, 2, 1, 0,
   (...)
This is related to the non-associative operation A049581(x,y) = |x - y| =: x @ y. Specifically, @ is commutative and any x is its own inverse, so non-associativity of @ can be measured through the commutator ((x @ y) @ y) @ x which equals twice the element indexed {m,k} = {x,y} in the above triangle.
(End)
		

Crossrefs

a(n) = abs(A305258(n)).

Programs

  • Mathematica
    a[n_] := (k =.; k = Reduce[k > 0 && k*(k+1)/2 == n, Reals][[2]] // Floor; Min[(k+1)*(k+2)/2 - n, n - k*(k+1)/2]); Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Jan 08 2013 *)
    Module[{trms=120,t},t=Accumulate[Range[Ceiling[(Sqrt[8*trms+1]-1)/2]]]; Join[{0},Flatten[Table[Abs[Nearest[t,n][[1]]-n],{n,trms}]]]] (* Harvey P. Dale, Nov 08 2013 *)
  • PARI
    print1(x=0, ", ");for(stride=1,13,x+=stride;y=x+stride+1;for(k=x,y-1,print1(min(k-x,y-k), ", "))) \\ Hugo Pfoertner, Jun 02 2018
    
  • PARI
    apply( {a(n)=if(n,-abs(n*2-(n=sqrtint(8*n-7)\/2)^2)+n)\2}, [0..40]) \\ same as (i - |j - |i-j||)/2 with i=sqrtint(8*n-7)\/2, j=n-i(i-1)/2. - M. F. Hasler, Dec 06 2019
    
  • Python
    from math import isqrt
    def A053616(n): return abs((m:=isqrt(k:=n<<1))*(m+1)-k)>>1 # Chai Wah Wu, Jul 15 2022

Formula

a(n) = (x - |y - |x-y||)/2, when (x,y) is the n-th element in the triangle x >= y >= 1. - M. F. Hasler, Dec 06 2019
a(n) = (1/2)*abs(t^2 + t - 2*n), where t = floor(sqrt(2*n)) = A172471. - Ridouane Oudra, Dec 15 2021
From Ctibor O. Zizka, Nov 12 2024: (Start)
For s >= 1, t from [0, s] :
a(2*s^2 + t) = s - t.
a(2*s^2 - t) = s - t.
a(2*s^2 + 2*s - t) = s - t.
a(2*s^2 + 2*s + 1 + t) = s - t. (End)

A271751 Period 10 zigzag sequence; repeat: [0, 1, 2, 3, 4, 5, 4, 3, 2, 1].

Original entry on oeis.org

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

Views

Author

Wesley Ivan Hurt, Apr 13 2016

Keywords

Comments

Decimal expansion of 11111/900009. - Elmo R. Oliveira, Mar 03 2024

Crossrefs

Period k zigzag sequences: A000035 (k=2), A007877 (k=4), A260686 (k=6), A266313 (k=8), this sequence (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).

Programs

  • Magma
    &cat[[0, 1, 2, 3, 4, 5, 4, 3, 2, 1]: n in [0..10]];
    
  • Maple
    a:=n->[0, 1, 2, 3, 4, 5, 4, 3, 2, 1][(n mod 10)+1]: seq(a(n), n=0..100);
  • Mathematica
    CoefficientList[Series[x*(1 + x + x^2 + x^3 + x^4)/(1 - x + x^5 - x^6), {x, 0, 30}], x]
  • PARI
    a(n) = abs(n-10*round(n/10)); \\ Altug Alkan, Apr 13 2016

Formula

G.f.: x*(1 + x + x^2 + x^3 + x^4)/(1 - x + x^5 - x^6).
a(n) = a(n-1) - a(n-5) + a(n-6) for n>5.
a(n) = abs(n - 10*round(n/10)).
a(n) = Sum_{i=1..n} (-1)^floor((i-1)/5).
a(2n) = 2*abs(A117444(n)).
a(2n+7) = 2*A076839(n)-1 for n>0.
a(n) = a(n-10) for n >= 10. - Wesley Ivan Hurt, Sep 07 2022

A090223 Nonnegative integers with doubled multiples of 4.

Original entry on oeis.org

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

Views

Author

Wolfdieter Lang, Dec 01 2003

Keywords

Comments

Degrees of row-polynomials of array A090222.
a(n) is the number of full orbits completed by body A for n full orbits completed by body B in a celestial system with two orbiting bodies A and B with orbital resonance A:B equal to 4:5. This resonance is exhibited by the planets Kepler-90b and Kepler-90c in the planetary system of the star Kepler-90. - Felix Fröhlich, May 03 2021

Crossrefs

Cf. A057353 and other floors of ratios references there.
Cf. A090222.

Programs

Formula

a(n) = floor(4*n/5).
G.f.: x^2 *(1+x^2)*(1+x)/((1-x^5)*(1-x)) = (x^2)*(1-x^4)/((1-x^5)*(1-x)^2).
a(n) = n - 1 - A002266(n - 1). - Wesley Ivan Hurt, Nov 15 2013
a(n) = A057354(2*n). - R. J. Mathar, Jul 21 2020
5*a(n) = 4*n-2+A117444(n+2) . - R. J. Mathar, Jul 21 2020
Sum_{n>=2} (-1)^n/a(n) = (2*sqrt(2)-1)*Pi/8. - Amiram Eldar, Sep 30 2022

A257145 a(n) = 5 * floor( (n+2) / 5) - n with a(0) = 1.

Original entry on oeis.org

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

Views

Author

Michael Somos, Apr 16 2015

Keywords

Comments

Cycle period is 5, {0, -1, -2, 2, 1} after the first five terms. - Robert G. Wilson v, Aug 02 2018

Examples

			G.f. = 1 - x - 2*x^2 + 2*x^3 + x^4 - x^6 - 2*x^7 + 2*x^8 + x^9 - x^11 + ...
		

Crossrefs

Programs

  • Haskell
    a257145 0 = 1
    a257145 n = div (n + 2) 5 * 5 - n  -- Reinhard Zumkeller, Apr 17 2015
    
  • Magma
    m:=60; R:=PowerSeriesRing(Integers(), m); Coefficients(R!((1-x)*(1-x^2)^2/(1-x^5))); // G. C. Greubel, Aug 02 2018
  • Mathematica
    a[ n_] := If[ n==0, 1, -Mod[ n, 5, -2]];
    a[ n_] := If[ n==0, 1, Sign[n] SeriesCoefficient[ (1 - x) * (1 - x^2)^2 / (1 - x^5), {x, 0, Abs@n}]];
    CoefficientList[Series[(1-x)*(1-x^2)^2/(1-x^5), {x,0,60}], x] (* G. C. Greubel, Aug 02 2018 *)
    a[n_] := 5 Floor[(n + 2)/5] - n; Array[a, 77, 0] (* or *)
    CoefficientList[ Series[(x - 1)^2 (x + 1)^2/(x^4 + x^3 + x^2 + x + 1), {x, 0, 76}], x] (* or *)
    LinearRecurrence[{-1, -1, -1, -1}, {1, -1, -2, 2, 1, 0}, 76] (* Robert G. Wilson v, Aug 02 2018*)
  • PARI
    {a(n) = if( n==0, 1, (n+2) \ 5 * 5 - n)};
    
  • PARI
    {a(n) = if( n==0, 1, [0, -1, -2, 2, 1][n%5 + 1])};
    
  • PARI
    {a(n) = if( n==0, 1, sign(n) * polcoeff( (1 - x) * (1 - x^2)^2 / (1 - x^5) + x * O(x^abs(n)), abs(n)))};
    
  • PARI
    x='x+O('x^60); Vec((1-x)*(1-x^2)^2/(1-x^5)) \\ G. C. Greubel, Aug 02 2018
    

Formula

Euler transform of length 5 sequence [-1, -2, 0, 0, 1].
a(5*n) = 0 for all n in Z except n=0.
a(n) = -a(-n) for all n in Z except n=0.
a(n) = a(n+5) for all n in Z except n=-5 or n=0.
Convolution inverse is A257143.
G.f.: (1 - x) * (1 - x^2)^2 / (1 - x^5).
G.f.: (1 - 2*x^2 + x^4) / (1 + x + x^2 + x^3 + x^4).
a(n) = -A117444(n), n>0. - R. J. Mathar, Oct 05 2017

A165190 G.f.: 1/((1-x^4)*(1-x^5)).

Original entry on oeis.org

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

Views

Author

Alford Arnold, Sep 24 2009

Keywords

Comments

A121262 convolved with A079998. The two sequences have very simple generating functions and can be mapped to the numeric partitions 4=4 and 5=5 respectively.
Number of partitions of n into parts 4 and 5. - Joerg Arndt, Aug 28 2015

Crossrefs

Programs

  • Magma
    [Floor((n+4)/4) - Floor((n+4)/5) : n in [0..100]]; // Wesley Ivan Hurt, Aug 27 2015
  • Maple
    A165190:=n->floor((n+4)/4) - floor((n+4)/5): seq(A165190(n), n=0..100); # Wesley Ivan Hurt, Aug 27 2015
  • Mathematica
    CoefficientList[Series[1/((1-x^4)(1-x^5)),{x,0,110}],x] (* or *) LinearRecurrence[{0,0,0,1,1,0,0,0,-1},{1,0,0,0,1,1,0,0,1},110] (* Harvey P. Dale, Aug 16 2012 *)
    Table[Floor[(n + 4)/4] - Floor[(n + 4)/5], {n, 0, 100}] (* Wesley Ivan Hurt, Aug 27 2015 *)

Formula

1 followed by the Euler transform of the finite sequence [0,0,0,1,1].
G.f.: 1/((1-x)^2*(1+x)*(1+x^2)*(1+x+x^2+x^3+x^4)). [R. J. Mathar, Oct 07 2009]
a(n) = A117444(n+2)/5 + n/20 + 9/40 + (-1)^n/8 + A057077(n)/4. [R. J. Mathar, Oct 07 2009]
a(0)=1, a(1)=0, a(2)=0, a(3)=0, a(4)=1, a(5)=1, a(6)=0, a(7)=0, a(8)=1, a(n) = a(n-4)+a(n-5)-a(n-9), n>8. - Harvey P. Dale, Aug 16 2012
a(n) = floor((n+4)/4) - floor((n+4)/5). - Wesley Ivan Hurt, Aug 27 2015
a(n)+a(n-2) = A008616(n). - R. J. Mathar, Jun 23 2021

Extensions

Removed duplicate of comment in A165188; Euler transform formula corrected - R. J. Mathar, Oct 07 2009

A188125 Number of strictly increasing arrangements of 6 nonzero numbers in -(n+4)..(n+4) with sum zero.

Original entry on oeis.org

4, 16, 52, 137, 308, 624, 1154, 1999, 3278, 5144, 7772, 11387, 16230, 22602, 30830, 41303, 54440, 70734, 90706, 114963, 144146, 178984, 220244, 268797, 325548, 391514, 467756, 555449, 655816, 770208, 900020, 1046787, 1212094, 1397668
Offset: 0

Views

Author

R. H. Hardin, Mar 21 2011

Keywords

Comments

Row 6 of A188122.

Examples

			4 + 16*x + 52*x^2 + 137*x^3 + 308*x^4 + 624*x^5 + 1154*x^6 + 1999*x^7 + 3278*x^8 + ...
Some solutions for n=6
-10...-8...-7...-8...-8...-9...-9...-9...-9...-7..-10...-9...-7..-10...-9...-9
.-8...-6...-5...-5...-6...-3...-7...-3...-2...-5...-6...-5...-5...-6...-4...-5
.-1....1...-1...-1...-1...-2...-2....1...-1...-2...-2...-1...-1...-2...-2...-4
..4....3....1....1....2....3....3....2....1....1....2....1....3....3....1....3
..7....4....2....3....5....4....5....4....2....4....6....6....4....5....5....6
..8....6...10...10....8....7...10....5....9....9...10....8....6...10....9....9
		

Crossrefs

Programs

  • PARI
    {a(n) = local(v, c, m); m = n+4; forvec( v = vector( 6, i, [-m, m]), if( 0==prod( k=1, 6, v[k]), next); if( 0==sum( k=1, 6, v[k]), c++), 2); c} /* Michael Somos, Apr 11 2011 */

Formula

Empirical: a(n)=2*a(n-1)-a(n-3)-a(n-5)+2*a(n-8)-a(n-11)-a(n-13)+2*a(n-15)-a(n-16)
= 168587/43200 +187*n/32 +3593*n^3/2160 +619*n^2/144 +457*n^4/1440 +11*n^5/450 -(-1)^n/64-3*n*(-1)^n/32 +4*(-1)^n*A119910(n+1)/27 -2*A117444(n+2)/25 +A057077(n)/8.
Empirical: G.f. -x*(-16 -20*x -33*x^2 -50*x^3 -60*x^4 -59*x^5 -51*x^6 -41*x^7 -18*x^8 -3*x^9 -x^10 +x^11 +4*x^12 -2*x^13 -7*x^14 +4*x^15) / ( (1+x+x^2) *(x^4+x^3+x^2+x+1) *(x^2+1) *(1+x)^2 *(x-1)^6 ). - R. J. Mathar, Mar 21 2011

A117445 Periodic {0,-1,1,4,-1,4,-4,-4,1,1,-4,-4,4,-1,4,1,-1} (period 17).

Original entry on oeis.org

0, -1, 1, 4, -1, 4, -4, -4, 1, 1, -4, -4, 4, -1, 4, 1, -1, 0, -1, 1, 4, -1, 4, -4, -4, 1, 1, -4, -4, 4, -1, 4, 1, -1, 0, -1, 1, 4, -1, 4, -4, -4, 1, 1, -4, -4, 4, -1, 4, 1, -1, 0, -1, 1, 4, -1, 4, -4, -4, 1, 1, -4, -4, 4, -1, 4, 1, -1, 0, -1, 1, 4, -1, 4, -4, -4, 1, 1, -4, -4
Offset: 0

Views

Author

Paul Barry, Mar 16 2006

Keywords

Crossrefs

Cf. A117444.

Programs

  • Mathematica
    PadRight[{},60,{0,-1,1,4,-1,4,-4,-4,1,1,-4,-4,4,-1,4,1,-1}] (* Harvey P. Dale, Sep 11 2012 *)
    LinearRecurrence[{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},{0,-1,1,4,-1,4,-4,-4,1,1,-4,-4,4,-1,4,1},80]
    (* Ray Chandler, Jul 15 2015 *)

Formula

G.f.: (-1)*x*(1+x)*(1-x)^2*(1 -3*x^2 -3*x^3 -10*x^4 -6*x^5 -9*x^6 -6*x^7 -10*x^8 -3*x^9 -3*x^10 +x^12)/(1-x^17).
a(n) = (1/2)*Sum_{k=0..17} L(k*(k^2-n)/17), where L(j/p) is the Legendre symbol of j and p.
G.f.: (-x)*(1-x)*(1+x)*(1 -3*x^2 -3*x^3 -10*x^4 -6*x^5 -9*x^6 -6*x^7 -10*x^8 -3*x^9 -3*x^10 +x^12)/(1 +x +x^2 +x^3 +x^4 +x^5 +x^6 +x^7 +x^8 +x^9 +x^10 +x^11 +x^12 +x^13 +x^14 +x^15 +x^16). - R. J. Mathar, Feb 23 2015

A134301 Periodic sequence (0, 2, 6, 2, 0).

Original entry on oeis.org

0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0, 0, 2, 6, 2, 0
Offset: 0

Views

Author

Franz Vrabec, Jan 30 2008

Keywords

Comments

Also: twice the partial sums of A117444. - R. J. Mathar, Feb 01 2008

Programs

Formula

a(n) = n(n+1) mod 10
O.g.f.: -2/(x-1)+(2*x^3+2*x^2-2*x-2)/(1+x+x^2+x^3+x^4). a(n)=a(n-5). - R. J. Mathar, Feb 01 2008
Showing 1-8 of 8 results.