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

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

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

Original entry on oeis.org

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

Views

Author

R. Muller

Keywords

Comments

Also concatenation of sequences n,n-1,...,2,1,2,...,n-1,n.
Table T(n,k) n, k > 0, T(n,k) = n-k+1, if n >= k, T(n,k) = k-n+1, 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, 2, 3, 4, 5, 6, 7, ...
  2, 1, 2, 3, 4, 5, 6, ...
  3, 2, 1, 2, 3, 4, 5, ...
  4, 3, 2, 1, 2, 3, 4, ...
  5, 4, 3, 2, 1, 2, 3, ...
  6, 5, 4, 3, 2, 1, 2, ...
  7, 6, 5, 4, 3, 2, 1, ...
  ...
The start of the sequence as triangle array read by rows:
  1;
  2, 1, 2;
  3, 2, 1, 2, 3;
  4, 3, 2, 1, 2, 3, 4;
  5, 4, 3, 2, 1, 2, 3, 4, 5;
  6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6;
  7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7;
  ...
Row number r contains 2*r - 1 numbers: r, r-1, ..., 1, 2, ..., r. (End)
		

References

  • F. Smarandache, "Numerical Sequences", University of Craiova, 1975; [ See Arizona State University, Special Collection, Tempe, AZ, USA ].

Crossrefs

Programs

  • Maple
    A004738 := proc(n)
        local tri ;
        tri := floor(sqrt(n)+1/2) ;
        tri+1-abs(n-1-tri^2) ;
    end proc:
    seq(A004738(n),n=1..30) ; #R. J. Mathar, Feb 14 2019
  • Mathematica
    row[n_] := Range[n, 1, -1] ~Join~ Range[2, n];
    Array[row, 10] // Flatten (* Jean-François Alcover, Apr 19 2020 *)
  • PARI
    a(n)= floor(sqrt(n)+1/2)+1-abs(n-1-(floor(sqrt(n)+1/2)-1/2)^2)
    
  • Python
    from math import isqrt
    def A004738(n): return abs((t:=isqrt(n-1))*(t+1)-n+1)+1 # Chai Wah Wu, Mar 01 2025

Formula

a(n) = floor(sqrt(n) + 1/2) + 1 - abs(n - 1 - (floor(sqrt(n) + 1/2))^2). - Benoit Cloitre, Feb 08 2003
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=2, a(n) = 2*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

A209301 Table T(n,k) n, k > 0, T(n,k)=n-k+1, if n>=k, T(n,k)=k-n+2, 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).

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Jan 18 2013

Keywords

Comments

In general, let m be 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. This sequence is result for m=3.

Examples

			The start of the sequence as table for the general case:
  1,   m, m+1, m+2, m+3, m+4, m+5, ...
  2,   1,   m, m+1, m+2, m+3, m+4, ...
  3,   2,   1,   m, m+1, m+2, m+3, ...
  4,   3,   2,   1,   m, m+1, m+2, ...
  5,   4,   3,   2,   1,   m, m+1, ...
  6,   5,   4,   3,   2,   1,   m, ...
  7,   6,   5,   4,   3,   2,   1, ...
  ...
The start of the sequence as triangle array read by rows for the general case:
  1;
  m,1,2;
  m+1,m,1,2,3;
  m+2,m+1,m,1,2,3,4;
  m+3,m+2,m+1,m,1,2,3,4,5;
  m+4, m+3,m+2,m+1,m,1,2,3,4,5,6;
  m+5, m+4, m+3,m+2,m+1,m,1,2,3,4,5,6,7;
  ...
Row number r contains 2*r -1 numbers: m+r-2, m+r-1,...m,1,2,...r.
The start of the sequence as triangle array read by rows for m=3:
  1;
  3,1,2;
  4,3,1,2,3;
  5,4,3,1,2,3,4;
  6,5,4,3,1,2,3,4,5;
  7,6,5,4,3,1,2,3,4,5,6;
  8,7,6,5,4,3,1,2,3,4,5,6,7;
  ...
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(n))-0.5)+1
    v=int((n-1)/t)-t+1
    result=k*v+(2*v-1)*(t**2-n)+t

Formula

For the general case
a(n) = m*v+(2*v-1)*(t*t-n)+t,
where
t = floor(sqrt(n)-1/2)+1,
v = floor((n-1)/t)-t+1.
For m=3
a(n) = 3*v+(2*v-1)*(t*t-n)+t,
where
t = floor(sqrt(n)-1/2)+1,
v = floor((n-1)/t)-t+1.

A289642 Number of 2-digit numbers whose digits add up to n.

Original entry on oeis.org

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

Views

Author

Miquel Cerda, Jul 09 2017

Keywords

Comments

The 2-digit numbers distributed according to the sum of their digits n.
Symmetrical sequence; a(n) = a(19 - n).

Examples

			n(5) = 5 because there are 5 numbers whose digits sum = 5 (14, 23, 32, 41, 50).
		

Crossrefs

Cf. A071817 (3-digit numbers), A090579 (4-digit numbers), A090580 (5-digit numbers), A090581 (6-digit numbers), A278969 (7-digit numbers), A278971 (8-digit numbers), A289354 (9-digit numbers), A053188, A074989, A004739, A066635, A154840, A249121.

Formula

G.f.: (1 - x^10)*(x - x^10)/(1 - x)^2.
a(n) = (19-abs(n-9)-abs(n-10))/2 for n=1..18. - Wesley Ivan Hurt, Jul 09 2017
Showing 1-4 of 4 results.