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 41-50 of 63 results. Next

A184220 a(n) = largest k such that A000290(n+1) = A000290(n) + (A000290(n) mod k), or 0 if no such k exists.

Original entry on oeis.org

0, 0, 0, 0, 14, 23, 34, 47, 62, 79, 98, 119, 142, 167, 194, 223, 254, 287, 322, 359, 398, 439, 482, 527, 574, 623, 674, 727, 782, 839, 898, 959, 1022, 1087, 1154, 1223, 1294, 1367, 1442, 1519, 1598, 1679, 1762
Offset: 1

Views

Author

Rémi Eismann, Jan 10 2011

Keywords

Comments

From the definition, a(n) = A000290(n) - A005408(n) if A000217(n) - A005408(n) > A005408(n), 0 otherwise, where A000290 are the squares and A005408 are the gaps between squares: 2n + 1.

Examples

			For n = 3 we have A000290(3) = 9, A000290(4) = 16; there is no k such that 16 - 9 = 7 = (9 mod k), hence a(3) = 0.
For n = 5 we have A000290(5) = 25, A000290(6) = 36; 14 is the largest k such that 36 - 25 = 11 = (25 mod k), hence a(5) = 14; a(5) = A000290(5) - A005408(5) = 25 - 11 = 14.
For n = 25 we have A000217(25) = 625, A000217(26) = 676; 574 is the largest k such that 676 - 625 = 51 = (625 mod k), hence a(25) = 574; a(25) = A000290(25) - A005408(25) = 574.
		

Crossrefs

Cf. essentially the same as A008865, A000290, A005408, A133150, A184221, A118534, A117078, A117563, A001223.

Formula

a(n) = (n-1)^2-2 = A008865(n-1) for n >= 5 and a(n) = 0 for n <= 4.

A263766 a(n) = Product_{k=1..n} (k^2 - 2).

Original entry on oeis.org

1, -1, -2, -14, -196, -4508, -153272, -7203784, -446634608, -35284134032, -3457845135136, -411483571081184, -58430667093528128, -9757921404619197376, -1893036752496124290944, -422147195806635716880512, -107225387734885472087650048
Offset: 0

Views

Author

Vladimir Reshetnikov, Oct 25 2015

Keywords

Examples

			For n = 3, a(3) = (1^2 - 2)*(2^2 - 2)*(3^2 - 2) = -14.
G.f. = 1 - x - 2*x^2 - 14*x^3 - 196*x^4 - 4508*x^5 - 153272*x^6 + ...
		

Crossrefs

Programs

  • Haskell
    a263766 n = a263766_list !! n
    a263766_list = scanl (*) 1 a008865_list
    -- Reinhard Zumkeller, Oct 26 2015
  • Mathematica
    Table[Product[k^2 - 2, {k, 1, n}], {n, 0, 16}]
    Expand@Table[-Pochhammer[Sqrt[2], n+1] Pochhammer[-Sqrt[2], n+1]/2, {n, 0, 16}]
    Join[{1},FoldList[Times,Range[20]^2-2]] (* Harvey P. Dale, Aug 14 2022 *)
  • PARI
    a(n) = prod(k=1, n, k^2-2); \\ Michel Marcus, Oct 25 2015
    

Formula

a(n) = Gamma(1+sqrt(2)+n)*Gamma(1-sqrt(2)+n)*sin(Pi*sqrt(2))/(Pi*sqrt(2)).
a(n) = A263688(n+1)^2-A263687(n+1)^2/2.
a(n) ~ exp(-2*n)*n^(2*n+1)*sqrt(2)*sin(Pi*sqrt(2)).
G.f. for 1/a(n): hypergeom([1],[1-sqrt(2),1+sqrt(2)], x).
E.g.f. for 1/a(n): hypergeom([],[1-sqrt(2),1+sqrt(2)], x).
E.g.f. for a(n)/n!: hypergeom([1-sqrt(2),1+sqrt(2)], [1], x).
Recurrence: a(0) = 1, a(n) = (n^2-2)*a(n-1).
0 = a(n)*(-24*a(n+2) - 15*a(n+3) + a(n+4)) + a(n+1)*(-9*a(n+2) - 4*a(n+3)) + a(n+2)*(+3*a(n+2)) if n>=0. - Michael Somos, Oct 30 2015

A305615 Next term is the largest earlier term that would not create a repetition of an earlier subsequence of length 2, if such a number exists; otherwise it is the smallest nonnegative number not yet in the sequence.

Original entry on oeis.org

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

Views

Author

Luc Rousseau, Jun 06 2018

Keywords

Comments

The map n |-> (a(n), a(n+1)) is a bijection between N and N X N: when drawn in a 2D array, this map makes progress by finishing the filling of a square gnomon before starting to fill the next one. This and the predictable zigzag way each gnomon is filled make it possible to deduce a closed formula for a(n).
A269501 is an essentially identical sequence: a(n) = A269501(n)-1. - N. J. A. Sloane, Jul 03 2018
For n > 3 indices for values = 1 are A008865(m), m > 2. - Bill McEachen, Oct 26 2023

Examples

			a(0): no already-used value exists, so one has to take the least nonnegative integer, so a(0) = 0;
a(1): reusing 0 is legal, so a(1) = 0. Repeating (0, 0) now becomes illegal;
a(2): reusing 0 is illegal since (a(1), a(2)) would repeat (0, 0). The smallest unused value is 1, so a(2) = 1. Repeating (0, 1) becomes illegal;
a(3): reusing 1 is legal. a(3) = 1. Repeating (1, 1) becomes illegal;
a(4): reusing 1 is illegal (would repeat (1, 1)) but reusing 0 is legal. a(4) = 0. Repeating (1, 0) becomes illegal;
and so on.
a(n) is also the x-coordinate of the cell that contains n in the following 2D infinite array:
  y
  ^
  |
  4 |... ... ... ... ...
    +---------------+
  3 | 9  14  12  10 |...
    +-----------+   |
  2 | 4   7   5 |11 |...
    +-------+   |   |
  1 | 1   2 | 6 |13 |...
    +---+   |   |   |
  0 | 0 | 3 | 8 |15 |...
    +---+---+---+---+---
      0   1   2   3   4 --->x
		

Crossrefs

For the 2D array shown in the EXAMPLE section, see A316323 and A269780. - N. J. A. Sloane, Jul 03 2018

Programs

  • Mathematica
    A[n_] := Module[{k, t}, k = Floor[Sqrt[n]]; t = n - k^2;
      Boole[t != 0]*k - Boole[OddQ[t]]*(t - 1)/2]; Table[A[n], {n, 0, 100}]
  • PARI
    a(n)=k=floor(sqrt(n));t=n-k^2;(t!=0)*k-(t%2)*(t-1)/2
    for(n=0,100,print1(a(n),", "))
  • Prolog
    main :- a(100, A, , ), reverse(A, R), writeln(R).
    a(0, [0], [0], []) :- !.
    a(N, A, V, P) :-
      M is N - 1, a(M, AA, VV, PP), AA = [AM | _],
      findall(L, (member(L, VV), not(member([AM, L], PP))), Ls),
      (Ls = [L | _] -> V = VV ; (length(VV, L), V = [L | VV])),
      A = [L | AA], P = [[AM, L] | PP].
    

Formula

a(n) = [t!=0]*k-[t is odd]*(t-1)/2, where k = floor(sqrt(n)), t = n-k^2 and [] stands for the Iverson bracket.

A349736 Binomial coefficients C(m,k) such that C(m,k), C(m,k+1), C(m,k+2) with 0 <= k <= m-2 form an increasing arithmetic progression.

Original entry on oeis.org

7, 1001, 490314, 927983760, 6973199770790, 209769429934732479, 25331521183260952835630, 12289694242827235919344118592, 23955991473971122736214778043009679, 187581456720371323313917970237305876898550, 5898404991626652623457605084827693331568853294440, 744569299056744628602691379013860201165514803170616390880
Offset: 1

Views

Author

Bernard Schott, Nov 28 2021

Keywords

Comments

Exercise A1 of 33rd Putnam Exam in 1972 asked one to prove that there are no four consecutive binomial coefficients C(m,k), C(m,k+1), C(m,k+2), C(m,k+3) in arithmetic progression (see link and reference).
However, as there exist such progressions with 3 terms, this sequence lists the smallest term of these arithmetic progressions.
Three consecutive binomial coefficients form an arithmetic progression iff m = n^2+4n+2, n >= 1 (2nd comment of A008865), and then, corresponding k = (n^2+3n-2)/2. Successive pairs (m,k) are (7,1), (14,4), (23,8), (34,13), (47,19), ...
By symmetry of Pascal's triangle with C(m,k) = C(m,m-k), there exists another decreasing arithmetic progression with the same 3 terms in the same row.
Corresponding common differences are in A349737.

Examples

			For n = 1, row 7 of Pascal's triangle is 1, 7, 21, 35, 35, 21, 7, 1; C(7,1) = 7, C(7,2) = 21 and C(7,3) = 35 form an arithmetic progression with common difference = 14, hence a(3) = 7 = C(7,1).
For n = 2, row 14 is 1, 14, 91, 364, 1001, 2002, 3003, 3432, 3003, 2002, 1001, 364, 91, 14, 1; C(14,4) = 1001 , C(14,5) = 2002 and C(14,6) = 3003 form an arithmetic progression with common difference = 1001, hence a(4) = 1001 = C(14,4).
		

References

  • G. L. Alexanderson, L. F. Klosinski and L. C. Larson, The William Lowell Putnam Mathematical Competition, Problems and Solutions 1965-1984, The Mathematical Association of America, 1985, page 17.

Crossrefs

Programs

  • Maple
    Sequence = seq(binomial(n^2+4*n+2,(n^2+3*n-2)/2), n=1..16);
  • Mathematica
    nterms=15; Table[Binomial[n^2+4n+2, (n^2+3n-2)/2], {n, nterms}] (* Paolo Xausa, Nov 29 2021 *)
  • PARI
    a(n) = binomial(n^2+4*n+2,(n^2+3*n-2)/2) \\ Andrew Howroyd, Oct 29 2023

Formula

a(n) = C(n^2+4n+2,(n^2+3n-2)/2) = C(A008865(n+2),A034856(n)), for n >= 1.
a(n) ~ c*2^(n^2+4*n)/n, where c = 4*sqrt(2/(Pi*e)). - Stefano Spezia, Nov 29 2021

Extensions

Missing a(9) = 23955...79 inserted by Georg Fischer, Oct 29 2023

A363102 Denominator of the continued fraction 1/(2-3/(3-4/(4-5/(...(n-1)-n/(-2))))).

Original entry on oeis.org

7, 7, 23, 17, 47, 31, 79, 7, 17, 71, 167, 97, 223, 127, 41, 23, 359, 199, 439, 241, 31, 41, 89, 337, 727, 1, 839, 449, 137, 73, 1087, 577, 1223, 647, 1367, 103, 1, 47, 73, 881, 1847, 967, 1, 151, 2207, 1151, 2399, 1249, 113, 193, 401, 1, 3023, 1567, 191, 41, 71, 257, 3719, 113, 3967, 89, 103, 311
Offset: 3

Views

Author

Mohammed Bouras, May 19 2023

Keywords

Comments

Conjecture 1: The sequence contains only 1's and primes.
Conjecture 2: All prime numbers appear either twice (same as A356247 and A357127) or three times.
Similar terms of A164314.
Conjecture: Record values correspond to A028871(m), m > 1. - Bill McEachen, Mar 06 2024
a(n) = 1 positions appear to correspond to A060515(m), m > 2. - Bill McEachen, Aug 05 2024

Examples

			a(5) = (5^2 - 2)/gcd(5^2 - 2, 2*A051403(5-3) + 5*A051403(5-4))= 23.
a(6) = a(11) = 6 + 11 = 17.
a(7) = a(40) = 7 + 40 = 47.
		

Crossrefs

Programs

  • PARI
    a051403(n) = (n+2)*sum(k=0, n, k!)/2;
    a(n) = (n^2 - 2)/gcd(n^2 - 2, 2*a051403(n-3) + n*a051403(n-4)); \\ Michel Marcus, May 24 2023

Formula

a(n) = (n^2 - 2)/gcd(n^2 - 2, 2*A051403(n-3) + n*A051403(n-4)).
a(n) = A164314(n) if A164314(n) > n.
If a(n) = a(m) and n < m < a(n), then a(n) = n + m.

A050271 Numbers k such that k = floor(sqrt(k)*ceiling(sqrt(k))).

Original entry on oeis.org

1, 2, 3, 4, 7, 8, 9, 14, 15, 16, 23, 24, 25, 34, 35, 36, 47, 48, 49, 62, 63, 64, 79, 80, 81, 98, 99, 100, 119, 120, 121, 142, 143, 144, 167, 168, 169, 194, 195, 196, 223, 224, 225, 254, 255, 256, 287, 288, 289, 322, 323, 324, 359, 360, 361, 398, 399, 400
Offset: 1

Views

Author

Benoit Cloitre, May 10 2003

Keywords

Comments

Is a(n) asymptotic to C*n^(3/2) where 1/2 < C < 1?
Consists exactly of numbers of the forms j^2 - 2, j^2 - 1, and j^2. As such, is asymptotic to (1/9)*n^2. - Ivan Neretin, Feb 08 2017

Crossrefs

Programs

  • Maple
    a:=n->floor((n+4)/3)^2+irem(n+1,3)-2:
    seq(a(n),n=1..58); # Lorenzo Sauras Altuzarra, Jan 31 2023
  • Mathematica
    Select[Range@400, Floor[(r = Sqrt@#)*Ceiling@r] == # &] (* Ivan Neretin, Feb 08 2017 *)
    LinearRecurrence[{1,0,2,-2,0,-1,1},{1,2,3,4,7,8,9},60] (* Harvey P. Dale, Aug 10 2025 *)
  • PARI
    isok(n) = floor(sqrt(n)*ceil(sqrt(n))) == n; \\ Michel Marcus, Nov 22 2013
    
  • PARI
    Vec(x*(1 + x + x^2 - x^3 + x^4 - x^5) / ((1 - x)^3*(1 + x + x^2)^2) + O(x^100)) \\ Colin Barker, Feb 09 2017
    
  • Python
    def A050271(n):
        a, b = divmod(n+4,3)
        return a**2+b-2 # Chai Wah Wu, Aug 02 2022

Formula

a(n) = floor((n + 4)/3)^2 + ((n + 1) mod 3) - 2. - Ivan Neretin, Feb 08 2017
From Colin Barker, Feb 09 2017: (Start)
a(n) = a(n-1) + 2*a(n-3) - 2*a(n-4) - a(n-6) + a(n-7) for n > 7.
G.f.: x*(1 + x + x^2 - x^3 + x^4 - x^5) / ((1 - x)^3*(1 + x + x^2)^2).
(End)
From Amiram Eldar, Sep 14 2022: (Start)
Sum_{n>=1} 1/a(n) = 2 + Pi^2/6 - cot(sqrt(2)*Pi)*Pi/(2*sqrt(2)).
Sum_{n>=1} (-1)^(n+1)/a(n) = 1 + Pi^2/12 + cosec(sqrt(2)*Pi)*Pi/(2*sqrt(2)). (End)
a(n) = A087278(n+1) - 1 if n > 0. - Lorenzo Sauras Altuzarra, Jan 31 2023

Extensions

Data corrected by Michel Marcus and Benoit Cloitre, Nov 22 2013

A144204 Array A(k,n) = (n+k-2)*(n-1) - 1 (k >= 1, n >= 1) read by antidiagonals.

Original entry on oeis.org

-1, -1, 0, -1, 1, 3, -1, 2, 5, 8, -1, 3, 7, 11, 15, -1, 4, 9, 14, 19, 24, -1, 5, 11, 17, 23, 29, 35, -1, 6, 13, 20, 27, 34, 41, 48, -1, 7, 15, 23, 31, 39, 47, 55, 63, -1, 8, 17, 26, 35, 44, 53, 62, 71, 80, -1, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, -1, 10, 21, 32, 43, 54, 65, 76, 87
Offset: 1

Views

Author

Jonathan Vos Post, Sep 13 2008

Keywords

Comments

Arises in complete intersection threefolds,
Also can be produced as a triangle read by rows: a(n, k) = nk - (n + k). - Alonso del Arte, Jul 09 2009
Kosta: Let X be a complete intersection of two hypersurfaces F_n and F_k in the projective space P^5 of degree n and k respectively. with n=>k, such that the singularities of X are nodal and F_k is smooth. We prove that if the threefold X has at most (n+k-2)*(n-1) - 1 singular points, then it is factorial.

Examples

			From _R. J. Mathar_, Jul 10 2009: (Start)
The rows A(n,1), A(n,2), A(n,3), etc., are :
.-1...0...3...8..15..24..35..48..63..80..99.120.143.168 A067998
.-1...1...5..11..19..29..41..55..71..89.109.131.155.181 A028387
.-1...2...7..14..23..34..47..62..79..98.119.142.167.194 A008865
.-1...3...9..17..27..39..53..69..87.107.129.153.179.207 A014209
.-1...4..11..20..31..44..59..76..95.116.139.164.191.220 A028875
.-1...5..13..23..35..49..65..83.103.125.149.175.203.233 A108195
.-1...6..15..26..39..54..71..90.111.134.159.186.215.246
.-1...7..17..29..43..59..77..97.119.143.169.197.227.259
.-1...8..19..32..47..64..83.104.127.152.179.208.239.272
.-1...9..21..35..51..69..89.111.135.161.189.219.251.285
.-1..10..23..38..55..74..95.118.143.170.199.230.263.298
.-1..11..25..41..59..79.101.125.151.179.209.241.275.311
.-1..12..27..44..63..84.107.132.159.188.219.252.287.324
.-1..13..29..47..67..89.113.139.167.197.229.263.299.337 Cf. A126719.
(End)
As a triangle:
. 0
. 1, 3
. 2, 5, 8
. 3, 7, 11, 15
. 4, 9, 14, 19, 24
. 5, 11, 17, 23, 29, 35
. 6, 13, 20, 27, 34, 41, 48
. 7, 15, 23, 31, 39, 47, 55, 63
. 8, 17, 26, 35, 44, 53, 62, 71, 80
		

Crossrefs

Row 1 = A067998(n) for n>0. Row 2 = A028387(n) for n>0.Column 1 = -A000012(n). Column 2 = A001477. Column 3 = A005408(k). Column 4 = A016789(k+1). Column 5 = A004767(k+2). Column 6 = A016897(k+3). Column 7 = A016969(k+4). Column 8 = A017053(k+5). Column 9 = A004771(k+6). Column 10 = A017257(k+7).

Programs

  • Maple
    A := proc(k,n) (n+k-2)*(n-1)-1 ; end: for d from 1 to 13 do for n from 1 to d do printf("%d,",A(d-n+1,n)) ; od: od: # R. J. Mathar, Jul 10 2009
  • Mathematica
    a[n_, k_] := a[n, k] = n*k - (n + k); ColumnForm[Table[a[n, k], {n, 10}, {k, n}], Center] (* Alonso del Arte, Jul 09 2009 *)

Formula

A[k,n] = (n+k-2)*(n-1) - 1.
Antidiagonal sum: Sum_{n=1..d} A(d-n+1,n) = d*(d^2-2d-1)/2 = -A110427(d). - R. J. Mathar, Jul 10 2009

Extensions

Duplicate of 6th antidiagonal removed by R. J. Mathar, Jul 10 2009
Keyword:tabl added by R. J. Mathar, Jul 23 2009
Edited by N. J. A. Sloane, Sep 14 2009. There was a comment that the defining formula was wrong, but it is perfectly correct.

A145068 Zero followed by partial sums of A059100, starting at n=1.

Original entry on oeis.org

0, 3, 9, 20, 38, 65, 103, 154, 220, 303, 405, 528, 674, 845, 1043, 1270, 1528, 1819, 2145, 2508, 2910, 3353, 3839, 4370, 4948, 5575, 6253, 6984, 7770, 8613, 9515, 10478, 11504, 12595, 13753, 14980, 16278, 17649, 19095, 20618, 22220, 23903, 25669
Offset: 1

Views

Author

Keywords

Examples

			a(2) = a(1) + 1^2 + 2 = 0 + 1 + 2 = 3; a(3) = a(2) + 2^2 + 2 = 3 + 4 + 2 = 9.
		

Crossrefs

Cf. A059100 (n^2+2), A002522 (n^2 + 1), A145066 (partial sums of A002522, starting at n=1), A008865 (n^2 - 2), A145067 (zero followed by partial sums of A008865), A005563 ((n+1)^2 - 1), A051925 (zero followed by partial sums of A005563).

Programs

  • Mathematica
    lst={0};s=0;Do[s+=n^2+2;AppendTo[lst,s],{n,5!}];lst
  • PARI
    {a=-2; for(n=0, 42, print1(a=a+n^2+2, ","))}

Formula

G.f.: x*(3-3*x+2*x^2)/(1-x)^4.
a(1) = 0; a(n) = sum_{j=1..n-1} A059100(j) = a(n-1) + (n-1)^2 + 2 for n > 1.

Extensions

Edited by Klaus Brockhaus, Oct 21 2008

A165662 Period 5: repeat 4,4,8,6,8.

Original entry on oeis.org

4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8, 4, 4, 8, 6, 8
Offset: 0

Views

Author

Vincenzo Librandi, Sep 24 2009

Keywords

Comments

This is also the post-period decimal digit of ((n+2)^2-2)/5.
Serves also as the decimal expansion of 1495600/33333 and as the continued fraction representation of (33397+sqrt(12952802))/1649.

Crossrefs

Programs

  • Magma
    [(2*n^2+8*n+4) mod 10 : n in [0..100]]; // Wesley Ivan Hurt, Sep 06 2014
    
  • Maple
    A165662:=n->2*n^2+8*n+4 mod 10: seq(A165662(n), n=0..100); # Wesley Ivan Hurt, Sep 06 2014
  • Mathematica
    Table[Mod[2 n^2 + 8 n + 4, 10], {n, 0, 100}] (* Wesley Ivan Hurt, Sep 06 2014 *)
    CoefficientList[Series[2 (2 + 2 x + 4 x^2 + 3 x^3 + 4 x^4)/(1 - x^5), {x, 0, 30}], x] (* Wesley Ivan Hurt, Sep 06 2014 *)
  • PARI
    a(n)=[4,4,8,6,8][n%5+1] \\ Edward Jiang, Sep 06 2014

Formula

a(n) = (2*n^2 + 8*n + 4) mod 10.
From Wesley Ivan Hurt, Sep 06 2014: (Start)
G.f.: 2*(2 + 2*x + 4*x^2 + 3*x^3 + 4*x^4)/(1-x^5). [corrected by Georg Fischer, May 11 2019]
Recurrence: a(n) = a(n-5).
a(n) = (2*A008865(n+1)) mod 10.
a(n) = (-A147973(n+4)) mod 10.
a(n+1) = 2*A053796(n) + 4. (End)

Extensions

Definition simplified, offset corrected by R. J. Mathar, Sep 25 2009
Name and offset changed by Wesley Ivan Hurt, Sep 06 2014

A214870 Natural numbers placed in table T(n,k) layer by layer. The order of placement: at the beginning filled odd places of layer clockwise, next - even places counterclockwise. T(n,k) read by antidiagonals.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 10, 9, 8, 13, 17, 16, 6, 14, 21, 26, 25, 11, 12, 22, 31, 37, 36, 18, 15, 20, 32, 43, 50, 49, 27, 24, 23, 30, 44, 57, 65, 64, 38, 35, 19, 33, 42, 58, 73, 82, 81, 51, 48, 28, 29, 45, 56, 74, 91, 101, 100, 66, 63, 39, 34, 41, 59, 72, 92, 111
Offset: 1

Views

Author

Boris Putievskiy, Mar 11 2013

Keywords

Comments

Permutation of the natural numbers.
a(n) is a pairing function: a function that reversibly maps Z^{+} x Z^{+} onto Z^{+}, where Z^{+} is the set of integer positive numbers.
Layer is pair of sides of square from T(1,n) to T(n,n) and from T(n,n) to T(n,1).
Enumeration table T(n,k) layer by layer. The order of the list:
T(1,1)=1;
T(1,2), T(2,1), T(2,2);
. . .
T(1,n), T(3,n), ... T(n,3), T(n,1); T(n,2), T(n,4), ... T(4,n), T(2,n);
. . .

Examples

			The start of the sequence as table:
   1   2   5  10  17  26 ...
   3   4   9  16  25  36 ...
   7   8   6  11  18  27 ...
  13  14  12  15  24  35 ...
  21  22  20  23  19  28 ...
  31  32  30  33  29  34 ...
  ...
The start of the sequence as triangle array read by rows:
   1;
   2,  3;
   5,  4,  7;
  10,  9,  8, 13;
  17, 16,  6, 14, 21;
  26, 25, 11, 12, 22, 31;
  ...
		

Crossrefs

Programs

  • Python
    t=int((math.sqrt(8*n-7) - 1)/ 2)
    i=n-t*(t+1)/2
    j=(t*t+3*t+4)/2-n
    if i > j:
       result=i*i-i+(j%2)*(2-(j+1)/2)+((j+1)%2)*(j/2+1)
    else:
       result=j*j-2*(i%2)*j + (i%2)*((i+1)/2+1) + ((i+1)%2)*(-i/2+1)

Formula

As table
T(n,k) = k*k-2*(n mod 2)*k+(n mod 2)*((n+1)/2+1)+((n+1) mod 2)*(-n/2+1), if n<=k;
T(n,k) = n*n-n+(k mod 2)*(2-(k+1)/2)+((k+1) mod 2)*(k/2+1), if n>k.
As linear sequence
a(n) = j*j-2*(i mod 2)*j+(i mod 2)*((i+1)/2+1)+((i+1) mod 2)*(-i/2+1), if i<=j;
a(n) = i*i-i+(j mod 2)*(2-(j+1)/2)+((j+1) mod 2)*(j/2+1), if i>j; where i=n-t*(t+1)/2, j=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2).
Previous Showing 41-50 of 63 results. Next