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

A004737 Concatenation of sequences (1,2,...,n-1,n,n-1,...,1) for n >= 1.

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5
Offset: 1

Views

Author

R. Muller

Keywords

Comments

The following sequences all have the same parity: A004737, A006590, A027052, A071028, A071797, A078358, A078446. - Jeremy Gardiner, Mar 16 2003
The ordinal transform of a sequence b_0, b_1, b_2, ... is the sequence a_0, a_1, a_2, ... where a_n is the number of times b_n has occurred in {b_0 ... b_n}.
From Artur Jasinski, Mar 07 2010: (Start)
This sequence is the even subset of A003983 for odd p=2,4,6,8,....
For the odd subset of A003983 see A004739. (End)
From Gary W. Adamson, Mar 30 2010: (Start)
Given the triangle rows: (1; 1,2,1; 1,2,3,2,1; ...) as polcoeff with offset 0:
q = (1 + 2x + x^2), r = (1 + 2x + 3x^2 + 2x^3 +x^4), etc.; then
(1 + 2x + 3x^2 + ...) = q(x) * q(x^2) * q(x^4) * q(x^8) * ...
..................... = r(x) * r(x^3) * r(x^9) * r(x^27) * ...
..................... = s(x) * s(x^4) * s(x^16)* s(x^64) * ...
... (End)
From L. Edson Jeffery, Jan 13 2012: (Start)
Let U_1(t)=1, U_2(t)=2*t, and U_r(t)=2*t*U_(r-1)(t)-U(r-2)(t), r>2, be Chebyshev polynomials of the second kind. For q>1 an integer, let N=2*q and x_k=cos((2*k-1)*Pi/N), and define the ordered column vectors V_k=[U_k(x_1), U_k(x_2), ..., U_k(x_q)]^T, k=1,...,q, where A^T denotes the transpose of matrix A. Let E_N=[V_1, V_2, ..., V_q] be the q X q matrix formed from the ordered components of the V_k. E_N contains the joint spectra of the Danzer basis (see [Jeffery]) associated with N. Let M_N=(1/q)*[E_N]^T*E_N. For the trivial case q=1, let M_2=[1]. CONJECTURE: E_N and M_N are always integral and symmetric, with M_N having diagonal entries {1,2,...} beginning at entries 1,j (j odd) in the first row and i,1 (i odd) in the first column and with zeros elsewhere. If N is allowed to increase without bound, and assuming the conjecture is true, then triangle A004737 emerges in its entirety from the successive antidiagonals containing those entries [M_N]_(i,j) such that i+j=2*v, for each v in {1,2,...,floor((q+1)/2)}. For example, for N=18 and q=9 (omitting the zeros for clarity),
M_18=[
(1 1 1 1 1);
( 2 2 2 2 );
(1 3 3 3 3);
( 2 4 4 4 );
(1 3 5 5 5);
( 2 4 6 6 );
(1 3 5 7 7);
( 2 4 6 8 );
(1 3 5 7 9)],
from which the first five rows of the sequence can be read off in succession. (End)
T(n,k) = min(n,k). The order of the list T(n,k) is by sides of squares from T(1,n) to T(n,n), then from T(n,n) to T(n,1). - Boris Putievskiy, Jan 13 2013
Expanded form of T(2,k) k=0,1,...,2m for ascending m-nomial triangles. - Bob Selcoe, Feb 07 2014
Terms in the first nine rows of the triangle can be duplicated by performing (111...)^2 with <= nine ones. By way of example, (11111)^2 = 123454321. - Gary W. Adamson, Mar 27 2015

Examples

			From _Boris Putievskiy_, Jan 13 2013: (Start)
The start of the sequence as a table:
  1 1 1 1 1 1 ...
  1 2 2 2 2 2 ...
  1 2 3 3 3 3 ...
  1 2 3 4 4 4 ...
  1 2 3 4 5 5 ...
  1 2 3 4 5 6 ...
  ...
The start of the sequence as an irregular triangle array read by rows:
  1;
  1,2,1;
  1,2,3,2,1;
  1,2,3,4,3,2,1;
  1,2,3,4,5,4,3,2,1;
  1,2,3,4,5,6,5,4,3,2,1;
  ...
Row number k contains 2*k-1 numbers: 1,2,...,k-1,k,k-1,...,1. (End)
The sequence of fractions A196199/A004737 = 0/1, -1/1, 0/2, 1/1, -2/1, -1/2, 0/3, 1/2, 2/1, -3/1, -2/2, -1/3, 0/4, 1/3, 2/2, 3/1, -4/4. -3/2, ... contains every rational number (infinitely often) [Laczkovich]. - _N. J. A. Sloane_, Oct 09 2013
		

References

  • Miklós Laczkovich, Conjecture and Proof, TypoTex, Budapest, 1998. See Chapter 10.
  • F. Smarandache, "Numerical Sequences", University of Craiova, 1975.

Crossrefs

Cf. A242357, A000290 (row sums).

Programs

  • Haskell
    import Data.List (inits)
    a004737 n = a004737_list !! (n-1)
    a004737_list = concatMap f $ tail $ inits [1..]
       where f xs = xs ++ tail (reverse xs)
    -- Reinhard Zumkeller, May 11 2014, Mar 26 2011
    
  • Mathematica
    Table[Min[n - #^2, (# + 1)^2 - n + 1] &@ Floor[Sqrt[n - 1]], {n, 105}] (* or *)
    Table[Floor@ # - Abs[n - Floor[#]^2 - Floor@ # - 1] + 1 &@ Sqrt[n - 1], {n, 105}] (* Michael De Vlieger, Oct 21 2016 *)
    Table[Join[Range[n],Range[n-1,1,-1]],{n,20}]//Flatten (* Harvey P. Dale, Dec 27 2019 *)
  • PARI
    a(n) = n--;my(m=sqrtint(n));m+1-abs(n-m^2-m) \\ David A. Corneth, Oct 18 2016

Formula

a(A002061(n)) = n; a(A000290(n)) = a(A002522(n)) = 1. - Reinhard Zumkeller, Mar 10 2006
a(n) = if n<3 then 1 else (if a(n-1)=1 then 1 + 0^(a(n-2)-1) else a(n-1) - 0^X + (a(n-1)-a(n-2))*(1 - 0^X)), where X = A003059(n-1)-a(n-1). - Reinhard Zumkeller, Mar 10 2006
Let b(n) = floor(sqrt(n-1)). Then a(n) = min(n - b(n)^2, (b(n)+1)^2 - n + 1). - Franklin T. Adams-Watters, Jun 09 2006
Ordinal transform of A004741. - Franklin T. Adams-Watters, Aug 28 2006
If the sequence is read as a triangular array, beginning [1]; [1,2,1]; [1,2,3,2,1]; ..., then the o.g.f. is (1+qx)/((1-x)(1-qx)(1-q^2x)) = 1 + x(1 + 2q + q^2) + x^2(1 + 2q + 3q^2 + 2q^3 +q^4) + .... The row polynomials for this triangle are (1 + q + ... + q^n)^2 =[n,2]A008967).%20-%20_Peter%20Bala">q + q[n-1,2]_q, where [n,2]_q are Gaussian polynomials (see A008967). - _Peter Bala, Sep 23 2007
a(n) = floor(sqrt(n-1)) - |n - floor(sqrt(n-1))^2 - floor(sqrt(n-1)) - 1| + 1. - Boris Putievskiy, Jan 13 2013
Read as a triangular array, then T(n,k) = n - |n-k-1|; T(n,0) = 1; T(n,n-1) = n. - Juan Pablo Herrera P., Oct 17 2016

Extensions

More terms from Patrick De Geest, Jun 15 1998

A087062 Array T(n,k) = lunar product n*k (n >= 1, k >= 1) read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 3, 2, 1, 1, 2, 3, 4, 3, 2, 1, 1, 2, 3, 4, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 10, 2, 3, 4, 5, 5, 4, 3, 2, 10, 11, 10, 3, 4, 5, 6, 5, 4, 3, 10, 11, 11, 11, 10, 4, 5, 6, 6, 5, 4, 10, 11, 11, 11, 12, 11, 10, 5, 6, 7, 6, 5, 10, 11, 12, 11, 11, 12, 12
Offset: 1

Views

Author

Marc LeBrun, Oct 09 2003

Keywords

Comments

See A087061 for definition. Note that 0+x = x and 9*x = x for all x.
This differs from A003983 at a(46): min(1,10)=1, while lunar product 10*1 = 10.
We have now changed the name from "dismal arithmetic" to "lunar arithmetic" - the old name was too depressing. - N. J. A. Sloane, Aug 06 2014

Examples

			Lunar multiplication table begins:
1 1 1 1 1 ...
1 2 2 2 2 ...
1 2 3 3 3 ...
1 2 3 4 4 ...
1 2 3 4 5 ...
		

Crossrefs

Cf. A087061 (addition), A003983 (min), A087097 (lunar primes).
See A261684 for a version that includes the zero row and column.

Programs

  • Maple
    # convert decimal to string: rec := proc(n) local t0,t1,e,l; if n <= 0 then RETURN([[0],1]); fi; t0 := n mod 10; t1 := (n-t0)/10; e := [t0]; l := 1; while t1 <> 0 do t0 := t1 mod 10; t1 := (t1-t0)/10; l := l+1; e := [op(e),t0]; od; RETURN([e,l]); end;
    # convert string to decimal: cer := proc(ep) local i,e,l,t1; e := ep[1]; l := ep[2]; t1 := 0; if l <= 0 then RETURN(t1); fi; for i from 1 to l do t1 := t1+10^(i-1)*e[i]; od; RETURN(t1); end;
    # lunar addition: dadd := proc(m,n) local i,r1,r2,e1,e2,l1,l2,l,l3,t0; r1 := rec(m); r2 := rec(n); e1 := r1[1]; e2 := r2[1]; l1 := r1[2]; l2 := r2[2]; l := max(l1,l2); l3 := min(l1,l2); t0 := array(1..l); for i from 1 to l3 do t0[i] := max(e1[i],e2[i]); od; if l>l3 then for i from l3+1 to l do if l1>l2 then t0[i] := e1[i]; else t0[i] := e2[i]; fi; od; fi; cer([t0,l]); end;
    # lunar multiplication: dmul := proc(m,n) local k,i,j,r1,r2,e1,e2,l1,l2,l,t0; r1 := rec(m); r2 := rec(n); e1 := r1[1]; e2 := r2[1]; l1 := r1[2]; l2 := r2[2]; l := l1+l2-1; t0 := array(1..l); for i from 1 to l do t0[i] := 0; od; for i from 1 to l2 do for j from 1 to l1 do k := min(e2[i],e1[j]); t0[i+j-1] := max(t0[i+j-1],k); od; od; cer([t0,l]); end;
  • Mathematica
    ladd[x_, y_] := FromDigits[MapThread[Max, IntegerDigits[#, 10, Max@IntegerLength[{x, y}]] & /@ {x, y}]];
    lmult[x_, y_] := Fold[ladd, 0, Table[10^i, {i, IntegerLength[y] - 1, 0, -1}]*FromDigits /@ Transpose@Partition[Min[##] & @@@ Tuples[IntegerDigits[{x, y}]], IntegerLength[y]]];
    Flatten[Table[lmult[k, n - k + 1], {n, 1, 13}, {k, 1, n}]] (* Davin Park, Oct 06 2016 *)
  • PARI
    lmul=A087062(m,n,d(n)=Vecrev(digits(n)))={sum(i=1,#(n=d(n))-1+#m=d(m), vecmax(vector(min(i,#n),j,if(#m>i-j,min(n[j],m[i-j+1]))))*10^i)\10} \\ M. F. Hasler, Nov 13 2017
  • Python
    def lunar_add(n,m):
        sn, sm = str(n), str(m)
        l = max(len(sn),len(sm))
        return int(''.join(max(i,j) for i,j in zip(sn.rjust(l,'0'),sm.rjust(l,'0'))))
    def lunar_mul(n,m):
        sn, sm, y = str(n), str(m), 0
        for i in range(len(sm)):
            c = sm[-i-1]
            y = lunar_add(y,int(''.join(min(j,c) for j in sn))*10**i)
        return y # Chai Wah Wu, Sep 06 2015
    

Extensions

Maple programs from N. J. A. Sloane.
Incorrect comment and Mathematica program removed by David Applegate, Jan 03 2012
Edited by M. F. Hasler, Nov 13 2017

A051125 Table T(n,k) = max{n,k} read by antidiagonals (n >= 1, k >= 1).

Original entry on oeis.org

1, 2, 2, 3, 2, 3, 4, 3, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 8, 7, 6, 5, 5, 6, 7, 8, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 8, 9, 10, 11, 12, 13, 14, 13
Offset: 1

Views

Author

Keywords

Comments

Antidiagonal sums = A006578. - Reinhard Zumkeller, Nov 17 2011

Examples

			Table begins
  1, 2, 3, 4, 5, ...
  2, 2, 3, 4, 5, ...
  3, 3, 3, 4, 5, ...
  4, 4, 4, 4, 5, ...
  ...
		

Crossrefs

Equals A003984(n) + 1.

Programs

  • GAP
    Flat(List([1..15], n-> List([1..n], k-> Maximum(n-k+1,k) ))); # G. C. Greubel, Jul 23 2019
  • Magma
    [Max(n-k+1,k): k in [1..n], n in [1..15]]; // G. C. Greubel, Jul 23 2019
    
  • Maple
    seq(seq(max(r,d+1-r),r=1..d),d=1..15); # Robert Israel, Jul 22 2016
  • Mathematica
    Flatten[Table[Max[n-k+1, k], {n, 13}, {k, n, 1, -1}]] (* Alonso del Arte, Nov 17 2011 *)
  • PARI
    T(n,k) = max(n,k) \\ Charles R Greathouse IV, Feb 07 2017
    
  • Sage
    [[max(n-k+1,k) for k in (1..n)] for n in (1..15)] # G. C. Greubel, Jul 23 2019
    

Formula

From Robert Israel, Jul 22 2016: (Start)
G.f. as table: G(x,y) = x*y*(1-3*x*y+x*y^2+x^2*y)/((1-x*y)*(1-x)^2*(1-y)^2).
G.f. flattened: (1-x)^(-2)*(x^2 + Sum_{j >= 0} x^(2*j^2) *(x+x^2 -2*x^(j+2)-2*x^(-j+2)+2*x^(2*j+2))). (End)

Extensions

More terms from Robert Lozyniak

A004197 Triangle read by rows. T(n, k) = n - k if n - k < k, otherwise k.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Table of min(x,y), where (x,y) = (0,0),(0,1),(1,0),(0,2),(1,1),(2,0),...
Highest power of 6 that divides A036561. - Fred Daniel Kline, May 29 2012
Triangle T(n,k) read by rows: T(n,k) = min(k,n-k). - Philippe Deléham, Feb 25 2014

Examples

			From _Philippe Deléham_, Feb 25 2014: (Start)
Top left corner of table:
  0 0 0 0
  0 1 1 1
  0 1 2 2
  0 1 2 3
Triangle T(n,k) begins:
  0;
  0, 0;
  0, 1, 0;
  0, 1, 1, 0;
  0, 1, 2, 1, 0;
  0, 1, 2, 2, 1, 0;
  0, 1, 2, 3, 2, 1, 0;
  0, 1, 2, 3, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 4, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0;
  0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0;
  ... (End)
		

Crossrefs

Similar to but strictly different from A087062 and A261684.
Row sums give A002620. - Reinhard Zumkeller, Jul 27 2005
Positions of zero are given in A117142. - Ridouane Oudra, Apr 30 2019

Programs

  • Haskell
    a004197 n k = a004197_tabl !! n !! k
    a004197_tabl = map a004197_row [0..]
    a004197_row n = hs ++ drop (1 - n `mod` 2) (reverse hs)
       where hs = [0..n `div` 2]
    -- Reinhard Zumkeller, Aug 14 2011
    
  • Maple
    T := (n, k) -> if n - k < k then n - k else k fi:
    for n from 0 to 9 do seq(T(n, k), k=0..n) od; # Peter Luschny, May 07 2023
  • Mathematica
    Flatten[Table[IntegerExponent[2^(n - k) 3^k, 6], {n, 0, 20}, {k, 0, n}]] (* Fred Daniel Kline, May 29 2012 *)
  • PARI
    T(x,y)=min(x,y) \\ Charles R Greathouse IV, Feb 07 2017

Formula

a(n) = A003983(n) - 1.
G.f.: x*y/((1-x)*(1-y)*(1-x*y)). - Franklin T. Adams-Watters, Feb 06 2006
2^T(n,k) = A144464(n,k), 3^T(n,k) = A152714(n,k), 4^T(n,k) = A152716(n,k), 5^T(n,k) = A152717(n,k). - Philippe Deléham, Feb 25 2014
a(n) = (1/2)*(t - 1 - abs(t^2 - 2*n - 1)), where t = floor(sqrt(2*n+1)+1/2). - Ridouane Oudra, May 03 2019

Extensions

Mathematica program fixed by Harvey P. Dale, Nov 26 2020
Name edited by Peter Luschny, May 07 2023

A130893 Lucas numbers (beginning with 1) mod 10.

Original entry on oeis.org

1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2, 1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2, 1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2, 1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2, 1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2, 1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2, 1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2, 1, 3, 4
Offset: 0

Views

Author

Philippe Lallouet (philip.lallouet(AT)wanadoo.fr), Aug 22 2007

Keywords

Comments

Period 12: repeat [1, 3, 4, 7, 1, 8, 9, 7, 6, 3, 9, 2].

Examples

			1 + 3 = 4 = 4 mod 10, then a(3) = 4.
3 + 4 = 7 = 7 mod 10, then a(4) = 7.
4 + 7 = 11 = 1 mod 10, then a(5) = 1.
		

Crossrefs

Programs

  • Magma
    [Lucas(n) mod 10: n in [1..100]]; // Vincenzo Librandi, Oct 01 2015
  • Mathematica
    Nest[Append[#, Mod[Total[Take[#, -2]], 10]] &, {1, 3}, 110]  (* Harvey P. Dale, Apr 05 2011 *)
    t = {1, 3}; Do[AppendTo[t, Mod[t[[-1]] + t[[-2]], 10]], {99}]; t (* T. D. Noe, Sep 16 2013 *)
    Mod[LucasL[Range[100]], 10] (* Alonso del Arte, Sep 30 2015 *)
    LinearRecurrence[{1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1}, {1, 3, 4, 7,
      1, 8, 9, 7, 6, 3, 9}, 100] (* G. C. Greubel, Feb 08 2016 *)
  • PARI
    a(n) = (fibonacci(n+1)+fibonacci(n-1)) % 10;
    vector(100, n, a(n)) \\ Altug Alkan, Sep 30 2015
    
  • Ruby
    def truncM10(n)
      a = 1
      b = 3
      n.times do
        a, b = (b % 10), ((a + b) % 10)
      end
      return b
    end
    # Joseph P. Shoulak, Sep 15 2013
    

Formula

a(n) = (a(n-2) + a(n-1)) mod 10, with a(0) = 1, a(1) = 3.
a(n) = A000204(n+1) mod 10 = A000032(n+1) mod 10. - Joerg Arndt, Sep 17 2013
a(n) = f(5(n-1)+2) mod 10, where f(n) is the n-th Fibonacci number (A000045). - Joseph P. Shoulak, Sep 15 2013
From G. C. Greubel, Feb 08 2016: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3) - a(n-4) + a(n-5) - a(n-6) + a(n-7) - a(n-8) + a(n-9) - a(n-10) + a(n-11).
a(n+12) = a(n). (End)

Extensions

Corrected and extended by Harvey P. Dale, Apr 05 2011
New name from Joerg Arndt, Sep 17 2013

A106314 Triangle T(n,k) composed of the squares min(n,k)^2.

Original entry on oeis.org

1, 1, 1, 1, 4, 1, 1, 4, 4, 1, 1, 4, 9, 4, 1, 1, 4, 9, 9, 4, 1, 1, 4, 9, 16, 9, 4, 1, 1, 4, 9, 16, 16, 9, 4, 1, 1, 4, 9, 16, 25, 16, 9, 4, 1, 1, 4, 9, 16, 25, 25, 16, 9, 4, 1
Offset: 1

Views

Author

Gary W. Adamson, Apr 28 2005

Keywords

Examples

			Replacing each term in A003983 by its square, we get:
{1},
{1, 1},
{1, 4, 1},
{1, 4, 4, 1},
{1, 4, 9, 4, 1},
{1, 4, 9, 9, 4, 1},
{1, 4, 9, 16, 9, 4, 1},
{1, 4, 9, 16, 16, 9, 4, 1},
{1, 4, 9, 16, 25, 16, 9, 4, 1},
{1, 4, 9, 16, 25, 25, 16, 9, 4, 1},
{1, 4, 9, 16, 25, 36, 25, 16, 9, 4, 1}
		

Crossrefs

Cf. A003983, A106314, A005993 (row sums).

Programs

  • Mathematica
    Clear[p, n, i];
    p[x_, n_] = Sum[x^i*If[i ==Floor[n/2] && Mod[n, 2] == 0, 0, If[i <= Floor[n/2], 2*i + 1, -(2*(n - i) + 1)]], {i, 0, n}]/(1 - x);
    Table[CoefficientList[FullSimplify[p[x, n]], x], {n, 1, 11}];
    Flatten[%]

Formula

T(n,k) = A003983(n,k)^2.

Extensions

Additional comments from Roger L. Bagula and Gary W. Adamson, Apr 02 2009

A124258 Triangle whose rows are sequences of increasing and decreasing squares: 1; 1,4,1; 1,4,9,4,1; ...

Original entry on oeis.org

1, 1, 4, 1, 1, 4, 9, 4, 1, 1, 4, 9, 16, 9, 4, 1, 1, 4, 9, 16, 25, 16, 9, 4, 1, 1, 4, 9, 16, 25, 36, 25, 16, 9, 4, 1, 1, 4, 9, 16, 25, 36, 49, 36, 25, 16, 9, 4, 1, 1, 4, 9, 16, 25, 36, 49, 64, 49, 36, 25, 16, 9, 4, 1, 1, 4, 9, 16, 25, 36, 49, 64, 81, 64, 49, 36, 25, 16, 9, 4, 1, 1, 4, 9, 16
Offset: 1

Views

Author

Jonathan Vos Post, Dec 16 2006

Keywords

Comments

The triangle A003983 with individual entries squared and each 2nd row skipped.
Analogous to A004737. - Peter Bala, Sep 25 2007
T(n,k) = min(n,k)^2. The order of the list T(n,k) is by sides of squares from T(1,n) to T(n,n), then from T(n,n) to T(n,1). - Boris Putievskiy, Jan 13 2013

Examples

			Triangle starts
  1;
  1, 4, 1;
  1, 4, 9, 4, 1:
  1, 4, 9, 16, 9, 4, 1:
From _Boris Putievskiy_, Jan 13 2013: (Start)
The start of the sequence as table:
  1...1...1...1...1...1...
  1...4...4...4...4...4...
  1...4...9...9...9...9...
  1...4...9..16..16..16...
  1...4...9..16..25..25...
  1...4...9..16..25..36...
  ...
The start of the sequence as triangle array read by rows:
  1;
  1, 4, 1;
  1, 4, 9,  4,  1;
  1, 4, 9, 16,  9,  4,  1;
  1, 4, 9, 16, 25, 16,  9,  4, 1;
  1, 4, 9, 16, 25, 36, 25, 16, 9, 4, 1;
  ...
Row number k contains 2*k-1 numbers 1,4,...,(k-1)^2,k^2,(k-1)^2,...,4,1. (End)
		

Crossrefs

Programs

  • Maple
    A003983 := proc(n,k) min(n,k) ; end: A124258 := proc(n,k) A003983(n,k)^2 ; end: for d from 1 to 20 by 2 do for c from 1 to d do printf("%d, ",A124258(d+1-c,c)) ; od: od: # R. J. Mathar, Sep 21 2007
    # second Maple program:
    T:= n-> i^2$i=1..n, (n-i)^2$i=1..n-1:
    seq(T(n), n=1..10);  # Alois P. Heinz, Feb 15 2022
  • Mathematica
    Flatten[Table[Join[Range[n]^2,Range[n-1,1,-1]^2],{n,10}]] (* Harvey P. Dale, Jun 14 2015 *)

Formula

O.g.f.: (1+qx)^2/((1-x)(1-qx)^2(1-q^2x)) = 1 + x(1 + 4q + q^2) + x^2(1 + 4q + 9q^2 + 4q^3 + q^4) + ... . - Peter Bala, Sep 25 2007
From Boris Putievskiy, Jan 13 2013: (Start)
a(n) = (A004737(n))^2.
a(n) = (floor(sqrt(n-1)) - |n- floor(sqrt(n-1))^2- floor(sqrt(n-1))-1| +1)^2. (End)

Extensions

More terms from R. J. Mathar, Sep 21 2007
Edited by N. J. A. Sloane, Jun 30 at the suggestion of R. J. Mathar

A157454 Triangle read by rows: T(n, m) = min(2*m - 1, 2*(n - m) + 1).

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 3, 5, 3, 1, 1, 3, 5, 5, 3, 1, 1, 3, 5, 7, 5, 3, 1, 1, 3, 5, 7, 7, 5, 3, 1, 1, 3, 5, 7, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9, 11, 9, 7, 5, 3, 1
Offset: 1

Views

Author

Roger L. Bagula, Mar 01 2009

Keywords

Examples

			Triangle starts:
  1;
  1,  1;
  1,  3,  1;
  1,  3,  3,  1;
  1,  3,  5,  3,  1;
  1,  3,  5,  5,  3,  1;
  1,  3,  5,  7,  5,  3,  1;
  1,  3,  5,  7,  7,  5,  3,  1;
  1,  3,  5,  7,  9,  7,  5,  3,  1;
  1,  3,  5,  7,  9,  9,  7,  5,  3,  1;
  1,  3,  5,  7,  9, 11,  9,  7,  5,  3,  1;
  ...
		

Crossrefs

Row sums are A000982(n).

Programs

  • GAP
    Flat(List([1..12], n-> List([1..n], k-> Minimum(2*k-1, 2*(n-k)+1) ))); # G. C. Greubel, Jun 30 2019
    
  • Haskell
    import Data.List (inits)
    a157454 n k = a157454_tabl !! (n-1) !! (k-1)
    a157454_row n = a157454_tabl !! (n-1)
    a157454_tabl = concatMap h $ tail $ inits [1, 3 ..] where
       h xs = [xs ++ tail xs', xs ++ xs'] where xs' = reverse xs
    -- Reinhard Zumkeller, Dec 15 2013
    
  • Magma
    [[Min(2*k-1, 2*(n-k)+1): k in [1..n]]: n in [1..12]]; // G. C. Greubel, Jun 30 2019
    
  • Mathematica
    Table[Min[2*k-1, 2*(n-k)+1], {n,1,12}, {k,1,n}]//Flatten (* modified by G. C. Greubel, Jun 30 2019 *)
  • PARI
    {T(n,k) = min(2*k-1, 2*(n-k)+1)};
    for(n=1,12, for(k=1,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Jun 30 2019
    
  • Python
    from math import isqrt
    def A157454(n): return (isqrt(n<<3)+1>>1)-abs((k:=n<<1)-((m:=isqrt(k))+(k>m*(m+1)))**2-1) # Chai Wah Wu, Jun 08 2025
  • Sage
    [[min(2*k-1, 2*(n-k)+1) for k in (1..n)] for n in (1..12)] # G. C. Greubel, Jun 30 2019
    

Formula

T(n,m) = T(n,n-m) = 2*m-1 for 0 <= m <= n/2, otherwise 2*(n-m)+1.
a(n) = 2*A003983(n) - 1.
From Ridouane Oudra, Jul 20 2019: (Start)
a(n) = A002024(n) - A049581(n-1).
a(n) = t - abs(t^2-2n+1), where t = floor(sqrt(2n)+1/2). (End)

Extensions

Edited by the Associate Editors of the OEIS, Apr 10 2009

A344837 Square array T(n, k), n, k >= 0, read by antidiagonals; T(n, k) = min(n * 2^max(0, w(k)-w(n)), k * 2^max(0, w(n)-w(k))) (where w = A070939).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, May 29 2021

Keywords

Comments

In other words, we right pad the binary expansion of the lesser of n and k with zeros (provided it is positive) so that both numbers have the same number of binary digits, and then take the least value.

Examples

			Array T(n, k) begins:
  n\k|  0  1  2   3  4   5   6   7  8  9  10  11  12  13  14  15
  ---+----------------------------------------------------------
    0|  0  0  0   0  0   0   0   0  0  0   0   0   0   0   0   0
    1|  0  1  2   2  4   4   4   4  8  8   8   8   8   8   8   8
    2|  0  2  2   2  4   4   4   4  8  8   8   8   8   8   8   8
    3|  0  2  2   3  4   5   6   6  8  9  10  11  12  12  12  12
    4|  0  4  4   4  4   4   4   4  8  8   8   8   8   8   8   8
    5|  0  4  4   5  4   5   5   5  8  9  10  10  10  10  10  10
    6|  0  4  4   6  4   5   6   6  8  9  10  11  12  12  12  12
    7|  0  4  4   6  4   5   6   7  8  9  10  11  12  13  14  14
    8|  0  8  8   8  8   8   8   8  8  8   8   8   8   8   8   8
    9|  0  8  8   9  8   9   9   9  8  9   9   9   9   9   9   9
   10|  0  8  8  10  8  10  10  10  8  9  10  10  10  10  10  10
   11|  0  8  8  11  8  10  11  11  8  9  10  11  11  11  11  11
   12|  0  8  8  12  8  10  12  12  8  9  10  11  12  12  12  12
   13|  0  8  8  12  8  10  12  13  8  9  10  11  12  13  13  13
   14|  0  8  8  12  8  10  12  14  8  9  10  11  12  13  14  14
   15|  0  8  8  12  8  10  12  14  8  9  10  11  12  13  14  15
		

Crossrefs

Cf. A344834 (AND), A344835 (OR), A344836 (XOR), A344838 (max), A344839 (absolute difference).

Programs

  • PARI
    T(n, k, op=min, w=m->#binary(m)) = { op(n*2^max(0, w(k)-w(n)), k*2^max(0, w(n)-w(k))) }

Formula

T(n, k) = T(k, n).
T(m, T(n, k)) = T(T(m, n), k).
T(n, n) = n.
T(n, 0) = 0.
T(n, 1) = A053644(n).

A004739 Concatenation of sequences (1,2,2,...,n-1,n-1,n,n,n-1,n-1,...,2,2,1) for n >= 1.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 1, 2, 3, 3, 2, 1, 1, 2, 3, 4, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 9, 8, 7
Offset: 1

Views

Author

R. Muller

Keywords

Comments

From Artur Jasinski, Mar 07 2010: (Start)
Zeta(2, k/p) + Zeta(2, (p-k)/p) = (Pi/sin((Pi*a(n))/p))*2, where p=2,3,4, k=1..p-1.
This sequence is the odd subset of A003983 for odd p=3,5,7,9,....
For the even subset of A003983 see A004737. (End)
Table T(n,k) n, k > 0, T(n,k) = n-k+1, if n >= k, T(n,k) = k-n, if n < k. Table read by sides of squares from T(1,n) to T(n,n), then from T(n,n) to T(n,1). General case A209301. Let m be a natural number. The first column of the table T(n,1) is the sequence of the natural numbers A000027. In all columns with number k (k > 1) the segment with the length of (k-1): {m+k-2, m+k-3, ..., m} shifts the sequence A000027. For m=1 the result is A004739, for m=2 the result is A004738, for m=3 the result is A209301. - Boris Putievskiy, Jan 24 2013

Examples

			From _Boris Putievskiy_, Jan 24 2013: (Start)
The start of the sequence as table:
  1, 1, 2, 3, 4, 5, 6, ...
  2, 1, 1, 2, 3, 4, 5, ...
  3, 2, 1, 1, 2, 3, 4, ...
  4, 3, 2, 1, 1, 2, 3, ...
  5, 4, 3, 2, 1, 1, 2, ...
  6, 5, 4, 3, 2, 1, 1, ...
  7, 6, 5, 4, 3, 2, 1, ...
  ...
The start of the sequence as triangle array read by rows:
  1;
  1, 1, 2;
  2, 1, 1, 2, 3;
  3, 2, 1, 1, 2, 3, 4;
  4, 3, 2, 1, 1, 2, 3, 4, 5;
  5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6;
  6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7;
  ...
Row number r contains 2*r - 1 numbers: r-1, r-2, ..., 1, 1, 2, ..., r. (End)
		

Crossrefs

Programs

  • Haskell
    a004739 n = a004739_list !! (n-1)
    a004739_list = concat $ map (\n -> [1..n] ++ [n,n-1..1]) [1..]
    -- Reinhard Zumkeller, Mar 26 2011
  • Mathematica
    aa = {}; Do[Do[AppendTo[aa, (p/Pi) ArcSin[Sqrt[1/((1/Pi^2) (Zeta[2, k/p] + Zeta[2, (p - k)/p]))]]], {k, 1, p - 1}], {p, 3, 50, 2}]; Round[N[aa, 50]] (* Artur Jasinski, Mar 07 2010 *)

Formula

From Boris Putievskiy, Jan 24 2013: (Start)
For the general case,
a(n) = m*v + (2*v-1)*(t*t-n) + t, where t = floor(sqrt(n) - 1/2) + 1 and v = floor((n-1)/t) - t + 1.
For m=1,
a(n) = v + (2*v-1)*(t*t-n) + t, where t = floor(sqrt(n) - 1/2) + 1 and v = floor((n-1)/t) - t + 1. (End)

Extensions

More terms from Patrick De Geest, Jun 15 1998
Previous Showing 11-20 of 42 results. Next