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-10 of 12 results. Next

A106450 a(n) = A004443(n) if n is odd, a(n) = A004443(n)/2 if n is even.

Original entry on oeis.org

2, 3, 0, 1, 3, 7, 2, 5, 5, 11, 4, 9, 7, 15, 6, 13, 9, 19, 8, 17, 11, 23, 10, 21, 13, 27, 12, 25, 15, 31, 14, 29, 17, 35, 16, 33, 19, 39, 18, 37, 21, 43, 20, 41, 23, 47, 22, 45, 25, 51, 24, 49, 27, 55, 26, 53, 29, 59, 28, 57, 31, 63, 30, 61, 33, 67, 32, 65, 35, 71, 34, 69, 37, 75
Offset: 0

Views

Author

Antti Karttunen, May 21 2005

Keywords

Crossrefs

Skipping the initial term (a(0)=2), this is row 2 of A106449.

Programs

  • PARI
    Vec((2+3*x-2*x^2-2*x^3+x^4+3*x^5+x^6)/((1-x)^2*(1+x)^2*(1+x^2)) + O(x^50)) \\ Colin Barker, Apr 19 2016

Formula

a(4*n+1) = 4*n+3, a(4*n+2) = 2*n, a(4*n+3) = 4*n+1, a(4*n+4) = 2*n+3.
From Colin Barker, Apr 19 2016: (Start)
a(n) = ((2+4*i)*(-i)^n+(2-4*i)*i^n-(-3+(-1)^n)*n)/4 for n>0 where i is the imaginary unit.
a(n) = a(n-2)+a(n-4)-a(n-6) for n>6.
G.f.: (2+3*x-2*x^2-2*x^3+x^4+3*x^5+x^6) / ((1-x)^2*(1+x)^2*(1+x^2)).
(End)
From Ilya Gutkovskiy, Apr 19 2016: (Start)
a(n) = (4*floor(1/(n+1)) - (-1)^n*n + 3*n + 8*sin((Pi*n)/2) + 4*cos((Pi*n)/2))/4.
E.g.f.: 1 + cos(x) + x*cosh(x) + 2*sin(x) + x*sinh(x)/2. (End)

A003987 Table of n XOR m (or Nim-sum of n and m) read by antidiagonals with m>=0, n>=0.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Another way to construct the array: construct an infinite square matrix starting in the top left corner using the rule that each entry is the smallest nonnegative number that is not in the row to your left or in the column above you.
After a few moves the [symmetric] matrix looks like this:
0 1 2 3 4 5 ...
1 0 3 2 5 ...
2 3 0 1 ?
3 2 1
4 5 ?
5
The ? is then replaced with a 6.

Examples

			Table begins
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, ...
   1,  0,  3,  2,  5,  4,  7,  6,  9,  8, 11, 10, ...
   2,  3,  0,  1,  6,  7,  4,  5, 10, 11,  8, ...
   3,  2,  1,  0,  7,  6,  5,  4, 11, 10, ...
   4,  5,  6,  7,  0,  1,  2,  3, 12, ...
   5,  4,  7,  6,  1,  0,  3,  2, ...
   6,  7,  4,  5,  2,  3,  0, ...
   7,  6,  5,  4,  3,  2, ...
   8,  9, 10, 11, 12, ...
   9,  8, 11, 10, ...
  10, 11,  8, ...
  11, 10, ...
  12, ...
  ...
The first few antidiagonals are
   0;
   1,  1;
   2,  0,  2;
   3,  3,  3,  3;
   4,  2,  0,  2,  4;
   5,  5,  1,  1,  5,  5;
   6,  4,  6,  0,  6,  4,  6;
   7,  7,  7,  7,  7,  7,  7,  7;
   8,  6,  4,  6,  0,  6,  4,  6,  8;
   9,  9,  5,  5,  1,  1,  5,  5,  9,  9;
  10,  8, 10,  4,  2,  0,  2,  4, 10,  8, 10;
  11, 11, 11, 11,  3,  3,  3,  3, 11, 11, 11, 11;
  12, 10,  8, 10, 12,  2,  0,  2, 12, 10,  8, 10, 12;
  ...
[Symmetric] matrix in base 2:
     0    1   10   11  100  101,  110  111 1000 1001 1010 1011 ...
     1    0   11   10  101  100,  111  110 1001 1000 1011  ...
    10   11    0    1  110  111,  100  101 1010 1011  ...
    11   10    1    0  111  110,  101  100 1011  ...
   100  101  110  111    0    1    10   11  ...
   101  100  111  110    1    0    11  ...
   110  111  100  101   10   11   ...
   111  110  101  100   11  ...
  1000 1001 1010 1011  ...
  1001 1000 1011  ...
  1010 1011  ...
  1011  ...
   ...
		

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.
  • Eric Friedman, Scott M. Garrabrant, Ilona K. Phipps-Morgan, A. S. Landsberg and Urban Larsson, Geometric analysis of a generalized Wythoff game, in Games of no Chance 5, MSRI publ. Cambridge University Press, date?
  • D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998; see p. 190. [From N. J. A. Sloane, Jul 14 2009]
  • R. K. Guy, Impartial games, pp. 35-55 of Combinatorial Games, ed. R. K. Guy, Proc. Sympos. Appl. Math., 43, Amer. Math. Soc., 1991.

Crossrefs

Initial rows are A001477, A004442, A004443, A004444, etc. Cf. A051775, A051776.
Cf. A003986 (OR), A004198 (AND), A221146 (carries).
Antidiagonal sums are in A006582.

Programs

  • Maple
    nimsum := proc(a,b) local t1,t2,t3,t4,l; t1 := convert(a+2^20,base,2); t2 := convert(b+2^20,base,2); t3 := evalm(t1+t2); map(x->x mod 2, t3); t4 := convert(evalm(%),list); l := convert(t4,base,2,10); sum(l[k]*10^(k-1), k=1..nops(l)); end; # memo: adjust 2^20 to be much bigger than a and b
    AT := array(0..N,0..N); for a from 0 to N do for b from a to N do AT[a,b] := nimsum(a,b); AT[b,a] := AT[a,b]; od: od:
    # alternative:
    read("transforms") :
    A003987 := proc(n,m)
        XORnos(n,m) ;
    end proc: # R. J. Mathar, Apr 17 2013
    seq(seq(Bits:-Xor(k,m-k),k=0..m),m=0..20); # Robert Israel, Dec 31 2015
  • Mathematica
    Flatten[Table[BitXor[b, a - b], {a, 0, 10}, {b, 0, a}]] (* BitXor and Nim Sum are equivalent *)
  • PARI
    tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitxor(k, n - k),", ");); print(););};
    tabl(13) \\ Indranil Ghosh, Mar 31 2017
    
  • Python
    for n in range(14):
        print([k^(n - k) for k in range(n + 1)]) # Indranil Ghosh, Mar 31 2017

Formula

T(2i,2j) = 2T(i,j), T(2i+1,2j) = 2T(i,j) + 1.

A004442 Natural numbers, pairs reversed: a(n) = n + (-1)^n; also Nimsum n + 1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

A self-inverse permutation of the natural numbers.
Nonnegative numbers rearranged with least disturbance to maintain a(n) not equal to n. - Amarnath Murthy, Sep 13 2002
Essentially lodumo_2 of A059841. - Philippe Deléham, Apr 26 2009
a(n) = A180176(n) for n >= 20. - Reinhard Zumkeller, Aug 15 2010

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    import Data.Bits (xor)
    a004442 = xor 1 :: Integer -> Integer
    a004442_list = concat $ transpose [a005408_list, a005843_list]
    -- Reinhard Zumkeller, Jun 23 2013, Feb 01 2013, Oct 20 2011
    
  • Maple
    a[0]:=1:a[1]:=0:for n from 2 to 70 do a[n]:=a[n-2]+2 od: seq(a[n], n=0..68); # Zerinvary Lajos, Feb 19 2008
  • Mathematica
    Table[n + (-1)^n, {n, 0, 72}] (* or *)
    CoefficientList[Series[(1 - x + 2x^2)/((1 - x)(1 - x^2)), {x, 0, 72}], x] (* Robert G. Wilson v, Jun 16 2006 *)
    Flatten[Reverse/@Partition[Range[0,69],2]] (* or *) LinearRecurrence[{1,1,-1},{1,0,3},70] (* Harvey P. Dale, Jul 29 2018 *)
  • PARI
    a(n)=n+(-1)^n \\ Charles R Greathouse IV, Nov 20 2012
    
  • PARI
    Vec((1-x+2*x^2)/((1-x)*(1-x^2)) + O(x^100)) \\ Altug Alkan, Feb 04 2016
    
  • Python
    def a(n): return n^1
    print([a(n) for n in range(69)]) # Michael S. Branicky, Jan 23 2022

Formula

a(n) = n XOR 1. - Odimar Fabeny, Sep 05 2004
G.f.: (1-x+2x^2)/((1-x)*(1-x^2)). - Mitchell Harris, Jan 10 2005
a(n+1) = lod_2(A059841(n)). - Philippe Deléham, Apr 26 2009
a(n) = 2*n - a(n-1) - 1 with n > 0, a(0)=1. - Vincenzo Librandi, Nov 18 2010
a(n) = Sum_{k=1..n-1} (-1)^(n-1-k)*C(n+1,k). - Mircea Merca, Feb 07 2013
For n > 1, a(n)^a(n) == 1 (mod n). - Thomas Ordowski, Jan 04 2016
Sum_{n>=0,n<>1} (-1)^n/a(n) = log(2) = A002162. - Peter McNair, Aug 07 2023

Extensions

Offset adjusted by Reinhard Zumkeller, Mar 05 2010

A269526 Square array T(n,k) (n>=1, k>=1) read by antidiagonals upwards in which each term is the least positive integer satisfying the condition that no row, column, diagonal, or antidiagonal contains a repeated term.

Original entry on oeis.org

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

Views

Author

Alec Jones, Apr 07 2016

Keywords

Comments

An infinite Sudoku-type array.
In the definition, "diagonal" means a diagonal line of slope -1, and "antidiagonal" means a diagonal line of slope +1.
Theorem C (Bob Selcoe, Jul 01 2016): Every column is a permutation of the natural numbers.
Proof: Fix k, and suppose j is the smallest number missing from that column. For this to happen, every entry T(n,k) for sufficiently large n in that column must see a j in the NW diagonal through that cell or in the row to the W of that cell. But there are at most k-1 copies of j in the columns to the left of the k-th column, and if n is very large the entry T(n,k) will be unaffected by those j's, and so T(n,k) would then be set to j, a contradiction. QED
Theorem R (Rob Pratt, Bob Selcoe, N. J. A. Sloane, Jul 02 2016): Every row is a permutation of the natural numbers.
Proof: Fix n, and suppose j is the smallest number missing from that row. For this to happen, every entry T(n,k) for sufficiently large k in that row must see a j in the column to the N, or in the NW diagonal through that cell or in the SW diagonal through that cell.
Rows 1 through n-1 contain at most n-1 copies of j, and their influence on the entries in the n-th row only extend out to the entry T(n,k_0), say. We take k to be much larger than k_0 and consider the entry T(n,k). We will show that for large enough k it can (and therefore must) be equal to j, which is a contradiction.
Consider the triangle bounded by row n, column 1, and the SW antidiagonal through cell (n,k). Replace every copy of j in this triangle by a queen and think of these cells as a triangular chessboard. These are non-attacking queens, by definition of the sequence, and by the result in A274616 there can be at most 2*k/3 + 1 such queens. However, there are k-k_0 cells in row n that have to be attacked, and for large k this is impossible since k-k_0 > 2*k/3+1. If a cell (n,k) is not attacked by a queen, then T(n,k) can take the value j. QED
Presumably every diagonal is also a permutation of the natural numbers, but the proof does not seem so straightforward. Of course the antidiagonals are not permutations of the natural numbers, since they are finite in length. - N. J. A. Sloane, Jul 02 2016
For an interpretation of this array in terms of Sprague-Grundy values, see A274528.
From Don Reble, Jun 30 2016: (Start)
Let b(n) be the position in column n where 1 appears, i.e., such that T(b(n),n) = 1. Then b(n) is A065188, which is Antti Karttunen's "Greedy Queens" permutation.
Let b'(n) be the position in row n where 1 appears, i.e., such that T(n,b'(n)) = 1. Then b'(n) is A065189, the inverse "Greedy Queens" permutation. (End)
The same sequence arises if we construct a triangle, by reading from left to right in each row, always choosing the smallest positive number which does not produce a duplicate number in any row or diagonal. - N. J. A. Sloane, Jul 02 2016
It appears that the numbers generally appear for the first time in or near the first few rows. - Omar E. Pol, Jul 03 2016
The last comment in the FORMULA section seems wrong: It seems that columns 4, 5, 6, 7, 8, 9, ...(?) all have first differences which become 16-periodic from, respectively, term 8, 17, 52, 91, 92, 131, ... on, rather than having period 4^(k-1) from term k on. - M. F. Hasler, Sep 26 2022

Examples

			The array is constructed along its antidiagonals, in the following way:
  a(1)  a(3)  a(6)  a(10)
  a(2)  a(5)  a(9)
  a(4)  a(8)
  a(7)
See the link from Peter Kagey for an animated example.
The beginning of the square array is:
   1,  3,  2,  6,  4,  5, 10, 11, 13,  8, 14, 18,  7, 20, 19,  9, 12, ...
   2,  4,  5,  1,  8,  3,  6, 12, 14, 16,  7, 15, 17,  9, 22, 21, 11, ...
   3,  1,  6,  2,  9,  7,  5,  4, 15, 17, 12, 19, 18, 21,  8, 10, 23, ...
   4,  2,  3,  5,  1,  8,  9,  7, 16,  6, 18, 17, 11, 10, 23, 22, 14, ...
   5,  7,  1,  4,  2,  6,  3, 15,  9, 10, 13,  8, 20, 14, 12, 11, 17, ...
   6,  8,  9,  7,  5, 10,  4, 16,  2,  1,  3, 11, 22, 15, 24, 13, 27, ...
   7,  5,  4,  3,  6, 14,  8,  9, 11, 18,  2, 21,  1, 16, 10, 12, 20, ...
   8,  6,  7,  9, 11,  4, 13,  3, 12, 15,  1, 10,  2,  5, 26, 14, 18, ...
   9, 11,  8, 10,  3,  1, 14,  6,  7, 13,  4, 12, 24, 18,  2,  5, 19, ...
  10, 12, 13, 11, 16,  2, 17,  5, 20,  9,  8, 14,  4,  6,  1,  7,  3, ...
  11,  9, 14, 12, 10, 15,  1,  8, 21,  7, 16, 20,  5,  3, 18, 17, 32, ...
  12, 10, 11,  8,  7,  9,  2, 13,  5, 23, 25, 26, 14, 17, 16, 15, 33, ...
...
  - _N. J. A. Sloane_, Jun 29 2016
		

Crossrefs

First 4 rows are A274315, A274316, A274317, A274791.
Main diagonal is A274318.
Column 1 is A000027, column 2 is A256008(n) = A004443(n-1)+1 = 1 + (nimsum of n-1 and 2), column 3 is A274614 (or equally, A274615 + 1), and column 4 is A274617 (or equally, A274619 + 1).
Antidiagonal sums give A274530. Other properties of antidiagonals: A274529, A275883.
Cf. A274080 (used in Haskell program), A274616.
A065188 and A065189 say where the 1's appear in successive columns and rows.
If all terms are reduced by 1 and the offset is changed to 0 we get A274528.
A274650 and A274651 are triangles in the shape of a right triangle and with a similar definition.
See A274630 for the case where both queens' and knights' moves must avoid duplicates.

Programs

  • Haskell
    import Data.List ((\\))
    a269526 n = head $ [1..] \\ map a269526 (a274080_row n)
    -- Peter Kagey, Jun 10 2016
    
  • Maple
    # The following Maple program was provided at my request by Alois P. Heinz, who said that he had not posted it himself because it stores the data in an inefficient way. - N. J. A. Sloane, Jul 01 2016
    A:= proc(n, k) option remember; local m, s;
             if n=1 and k=1 then 1
           else s:= {seq(A(i,k), i=1..n-1),
                     seq(A(n,j), j=1..k-1),
                     seq(A(n-t,k-t), t=1..min(n,k)-1),
                     seq(A(n+j,k-j), j=1..k-1)};
                for m while m in s do od; m
             fi
         end:
    [seq(seq(A(1+d-k, k), k=1..d), d=1..15)];
  • Mathematica
    A[n_, k_] := A[n, k] = If[n == 1 && k == 1, 1, s = {Table[A[i, k], {i, 1, n-1}], Table[A[n, j], {j, 1, k-1}], Table[A[n-t, k-t], {t, 1, Min[n, k] - 1}], Table[A[n+j, k-j], {j, 1, k-1}]} // Flatten; For[m = 1, True, m++, If[FreeQ[s, m], Return[m]]]];
    Table[Table[A[1+d-k, k], {k, 1, d}], {d, 1, 15}] // Flatten (* Jean-François Alcover, Jul 21 2016, translated from Maple *)
  • PARI
    {M269526=Map(); A269526=T(r,c)=c>1 && !mapisdefined(M269526, [r,c], &r) && mapput(M269526, [r,c], r=sum(k=1, #c=Set(concat([[T(r+k,c+k)|k<-[1-min(r, c)..-1]], [T(r,k)|k<-[1..c-1]], [T(k,c)|k<-[1..r-1]], [T(r+c-k,k)|k<-[1..c-1]]])), c[k]==k)+1); r} \\ M. F. Hasler, Sep 26 2022

Formula

Theorem 1: T(n,1) = n.
Proof by induction. T(1,1)=1 by definition. When calculating T(n,1), the only constraint is that it be different from all earlier entries in the first column, which are 1,2,3,...,n-1. So T(n,1)=n. QED
Theorem 2 (Based on a message from Bob Selcoe, Jun 29 2016): Write n = 4t+i with t >= 0, i=1,2,3, or 4. Then T(n,2) = 4t+3 if i=1, 4t+4 if i=2, 4t+1 if i=3, 4t+2 if i=4. This implies that the second column is the permutation A256008.
Proof: We check that the first 4 entries in column 2 are 2,5,6,3. From then on, to calculate the entry T(n,2), we need only look to the N, NW, W, and SW (we need never look to the East). After we have found the first 4t entries in the column, the column contains all the numbers from 1 to 4t. The four smallest free numbers are 4t+1, 4t+2, 4t+3, 4t+4. Entry T(4t+1,2) cannot be 4t+1 or 4t+2, but it can (and therefore must) be 4t+3. Similarly T(4t+2,2)=4t+4, T(4t+3,2)=4t+1, and T(4t+4,2)=4t+2. The column now contains all the numbers from 1 to 4t+4. Repeating this argument established the theorem. QED
Comments from Bob Selcoe, Jun 29 2016: (Start)
From Theorem 2, column 2 (i.e., terms a((j^2+j+4)/2), j>=1) is a permutation. After a(3)=3, the differences of successive terms follow the pattern a(n) = 3 [+1, -3, +1, +5], so a(5)=4, a(8)=1, a(12)=2, a(17)=7, a(23)=8, a(30)=5...
Similarly, column 3 (i.e., terms a((j^2+j+6)/2), j>=2) appears to be a permutation, but with the pattern after a(6)=2 and a(9)=5 being 5 [+1, -3, -2, +8, -5, +3, +1, +5, +1, -3, +1, -2, +8, -3, +1, +5]. (See A274614 and A274615.)
I conjecture that other similar cyclical difference patterns should hold for any column k (i.e., terms a((j^2+j+2*k)/2), j>=k-1), so that each column is a permutation.
Also, the differences in column 1 are a 1-cycle ([+1]), in column 2 a 4-cycle after the first term, and in column 3 a 16-cycle after the second term. Perhaps the cycle lengths are 4^(k-1) starting after j=k-1. (End) WARNING: These comments may be wrong - see COMMENTS section. - N. J. A. Sloane, Sep 26 2022

Extensions

Definition clarified by Omar E. Pol, Jun 29 2016

A017101 a(n) = 8n + 3.

Original entry on oeis.org

3, 11, 19, 27, 35, 43, 51, 59, 67, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 155, 163, 171, 179, 187, 195, 203, 211, 219, 227, 235, 243, 251, 259, 267, 275, 283, 291, 299, 307, 315, 323, 331, 339, 347, 355, 363, 371, 379, 387, 395, 403, 411, 419, 427
Offset: 0

Views

Author

Keywords

Comments

Apart from initial term(s), dimension of the space of weight 2n cusp forms for Gamma_0( 47 ).
Also numbers of the form x^2 + y^2 + z^2, where x,y,z are odd integers. - Alexander Adamchuk, Dec 01 2006
Conjecture: 2*a(n) is the half-period of oscillation of a Langton's ant colony that is n basic blocks in length. To construct such blocks use a pair of ants facing north at (x,y) and (x+1,y+2) (using Golly's coordinate system). Each successive block is placed 1 cell away from the previous one, i.e., the x coordinate shifts by 3, so we have (x+3k,y) and (x+3k+1,y+2). Also, because of the symmetry of the oscillation pattern, 4*a(n) is the length of the whole period (see MathOverflow link for details). - Mikhail Kurkov, Nov 20 2019

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 247.

Crossrefs

Programs

Formula

a(n) = A001969(2*n+1) + A001969(2*n) = A000069(2*n+1) + A000069(2*n). - Philippe Deléham, Feb 04 2004
G.f.: (3+5*x)/(1-x)^2. - R. J. Mathar, Mar 30 2011
a(n) = 2*a(n-1) - a(n-2) for n>1. - Vincenzo Librandi, May 28 2011
a(A002265(n)) = A004442(n) + A004443(n). - Wesley Ivan Hurt, Apr 06 2016
E.g.f.: exp(x)*(3 + 8*x). - Stefano Spezia, Nov 20 2019
a(n) = A004767(2*n), for n >= 0. See also A004767(2*n+1) = A004771(n). - Wolfdieter Lang, Feb 03 2022

A274528 Square array read by antidiagonals upwards: T(n,k) = A269526(n+1,k+1) - 1, n>=0, k>=0.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Jun 29 2016

Keywords

Comments

This sequence has essentially the same properties as the main sequence A269526, but now involves the nonnegative integers.
This version is important because of the following comment from Allan C. Wechsler, originally contributed to A269526. - N. J. A. Sloane, Jun 30 2016
Sprague-Grundy (Nim) values for a combinatorial game played with two piles of counters. Legal moves consist of removing any positive number of counters from either pile, or removing the same number from both piles, or moving any positive number of counters from the right pile to the left pile. If the Nim-values (as in Sprague-Grundy theory) are written in an array indexed by the number of counters in the two piles, we obtain this array. - Allan C. Wechsler, Jun 29 2016 [corrected by N. J. A. Sloane, Sep 25 2016]
The same sequence arises if we construct a triangle, by reading from left to right in each row, always choosing the smallest nonnegative number which does not produce a duplicate number in any row or diagonal. - N. J. A. Sloane, Jul 02 2016
It appears that the numbers generally appear for the first time in or near the first few rows. - Omar E. Pol, Jul 03 2016

Examples

			The corner of the square array begins:
0,  2,  1,  5,  3,  4,  9, 10, 12,  7, 13, 17,
1,  3,  4,  0,  7,  2,  5, 11, 13, 15,  6,
2,  0,  5,  1,  8,  6,  4,  3, 14, 16,
3,  1,  2,  4,  0,  7,  8,  6, 15,
4,  6,  0,  3,  1,  5,  2, 14,
5,  7,  8,  6,  4,  9,  3,
6,  4,  3,  2,  5, 13,
7,  5,  6,  8, 10,
8, 10,  7,  9,
9, 11, 12,
10, 8,
11,
		

Crossrefs

Columns 1, 2, 3, 4 give A001477, A004443, A274615, A274619.

Programs

  • Maple
    # From N. J. A. Sloane, Jul 30 2018, based on Heinz's program in A269526
    A:= proc(n, k) option remember; local m, s;
             if n=1 and k=1 then 0
           else s:= {seq(A(i, k), i=1..n-1),
                     seq(A(n, j), j=1..k-1),
                     seq(A(n-t, k-t), t=1..min(n, k)-1),
                     seq(A(n+j, k-j), j=1..k-1)};
                for m from 0 while m in s do od; m
             fi
         end:
    [seq(seq(A(1+d-k, k), k=1..d), d=1..12)];
  • Mathematica
    A[n_, k_] := A[n, k] = Module[{m, s}, If[n==1 && k==1, 0, s = Join[Table[ A[i, k], {i, 1, n-1}], Table[A[n, j], {j, 1, k-1}], Table[A[n-t, k-t], {t, 1, Min[n, k] - 1}], Table[A[n+j, k-j], {j, 1, k-1}]]; For[m = 0, MemberQ[s, m], m++]; m]];
    Table[A[d-k+1, k], {d, 1, 13}, {k, 1, d}] // Flatten (* Jean-François Alcover, May 03 2019, from Maple *)

A256008 Self-inverse permutation of positive integers: 4k+1 is swapped with 4k+3, and 4k+2 with 4k+4.

Original entry on oeis.org

3, 4, 1, 2, 7, 8, 5, 6, 11, 12, 9, 10, 15, 16, 13, 14, 19, 20, 17, 18, 23, 24, 21, 22, 27, 28, 25, 26, 31, 32, 29, 30, 35, 36, 33, 34, 39, 40, 37, 38, 43, 44, 41, 42, 47, 48, 45, 46, 51, 52, 49, 50, 55, 56, 53, 54, 59, 60, 57, 58, 63, 64, 61, 62, 67, 68, 65, 66, 71, 72, 69, 70, 75, 76, 73, 74, 79
Offset: 1

Views

Author

Ivan Neretin, May 06 2015

Keywords

Comments

A lexicographically minimal sequence of distinct positive integers such that a(n)*n + 1 is a square. The same condition without the requirement for a(n) to be distinct would produce A076942.

Crossrefs

Programs

  • Magma
    [n-2*(-1)^((2*n+1-(-1)^n) div 4): n in [1..100]]; // Wesley Ivan Hurt, Oct 13 2015
    
  • Magma
    I:=[3,4,1,2]; [n le 4 select I[n] else 2*Self(n-1)-2*Self(n-2)+2*Self(n-3)-Self(n-4): n in [1..80]]; // Vincenzo Librandi, Oct 14 2015
    
  • Magma
    /* By definition: */ &cat[[4*k+3,4*k+4,4*k+1,4*k+2]: k in [0..20]]; // Bruno Berselli, Oct 19 2015
    
  • Maple
    A256008:=n->n-2*(-1)^((2*n+1-(-1)^n)/4): seq(A256008(n), n=1..100); # Wesley Ivan Hurt, Oct 13 2015
  • Mathematica
    Table[BitXor[n - 1, 2] + 1, {n, 77}]
    CoefficientList[Series[(3 - 2*x - x^2 + 2*x^3)/((x - 1)^2*(x^2 + 1)), {x, 0, 100}], x] (* Wesley Ivan Hurt, Oct 13 2015 *)
    LinearRecurrence[{2, -2, 2, -1}, {3, 4, 1, 2}, 80] (* Vincenzo Librandi, Oct 14 2015 *)
  • PARI
    a(n) = bitxor(n-1,2)+1 \\ Charles R Greathouse IV, May 06 2015
    
  • PARI
    Vec(x*(3-2*x-x^2+2*x^3)/((x-1)^2*(x^2+1)) + O(x^100)) \\ Altug Alkan, Oct 13 2015
    
  • PARI
    a(n) = (-1+I)*((-I)^n+I*I^n)+n \\ Colin Barker, Oct 19 2015
    
  • Python
    def a(n): return ((n-1)^2) + 1
    print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Mar 21 2023

Formula

From Wesley Ivan Hurt, Oct 13 2015: (Start)
G.f.: x*(3-2*x-x^2+2*x^3)/((x-1)^2*(x^2+1)).
a(n) = 2*a(n-1)-2*a(n-2)+2*a(n-3)-a(n-4) for n>4.
a(n) = n-2*(-1)^((2*n+1-(-1)^n)/4). (End)
a(n) = (-1+i)*((-i)^n+i*i^n)+n, where i = sqrt(-1). - Colin Barker, Oct 19 2015
a(n) = 1 + A004443(n-1). - Alois P. Heinz, Jan 23 2022

A004444 Nimsum n + 3.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The same as A120634 except for first 3 terms. - Pietro Battiston, Jan 19 2008
Permutation of the nonnegative integers. - Wesley Ivan Hurt, Apr 06 2016

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.

Crossrefs

Cf. A004442 (nimsum n+1), A004443 (nimsum n+2), A120634.

Programs

  • Magma
    [n + (-1)^n + 2*(-1)^Floor(n/2): n in [0..100]]; // Wesley Ivan Hurt, Apr 06 2016
    
  • Maple
    A004444:=n->n+(-1)^n+2*(-1)^floor(n/2): seq(A004444(n), n=0..50); # Wesley Ivan Hurt, Apr 06 2016
  • Mathematica
    CoefficientList[Series[(4x^4-x^3-x^2-x+3)/((x-1)^2(x+1) (x^2+1)), {x,0,70}],x] (* Harvey P. Dale, Mar 24 2011 *)
    Table[n + (-1)^n + 2 (-1)^Floor[n/2], {n, 0, 100}] (* Wesley Ivan Hurt, Apr 06 2016 *)
  • PARI
    Vec((4*x^4-x^3-x^2-x+3)/((x-1)^2*(x+1)*(x^2+1)) + O(x^90)) \\ Michel Marcus, Apr 06 2016
    
  • Python
    def a(n): return n^3
    print([a(n) for n in range(69)]) # Michael S. Branicky, Jan 23 2022

Formula

G.f.: (4*x^4-x^3-x^2-x+3)/((x-1)^2*(x+1)*(x^2+1)). - Ralf Stephan, Nov 01 2003
a(n) = n + (-1)^n + 2*(-1)^floor(n/2). - Mitchell Harris, Jan 10 2005
From Wesley Ivan Hurt, Apr 06 2016: (Start)
a(n) = a(n-1) + a(n-4) - a(n-5) for n>4.
a(n) = n + (-1)^n + 2*(-1)^((2*n-1+(-1)^n)/4).
a(n) = A004442(A004443(n)) = A004443(A004442(n)).
a(a(n)) = n; n+a(n) = A004442(n) + A004443(n). (End)
a(n) = n XOR 3. - Falk Hüffner, Jan 23 2022

Extensions

More terms from Michael S. Branicky, Jan 23 2022

A174091 a(n) = n OR 2.

Original entry on oeis.org

2, 3, 2, 3, 6, 7, 6, 7, 10, 11, 10, 11, 14, 15, 14, 15, 18, 19, 18, 19, 22, 23, 22, 23, 26, 27, 26, 27, 30, 31, 30, 31, 34, 35, 34, 35, 38, 39, 38, 39, 42, 43, 42, 43, 46, 47, 46, 47, 50, 51, 50, 51, 54, 55, 54, 55, 58, 59, 58, 59, 62, 63, 62, 63, 66, 67, 66
Offset: 0

Views

Author

Gary Detlefs, Feb 06 2013

Keywords

Comments

OR(n, 2) + AND(n, 2) = n + 2.
OR(n, 2) - AND(n, 2) = n + 2*(-1)^floor(n/2), A004443.
a(n) = n when n = 2 or 3 mod 4 (n is in A042964). - Alonso del Arte, Feb 07 2013

Examples

			a(3) = 3 because OR(0011, 0010) = 0011 = 3.
a(4) = 6 because OR(0100, 0010) = 0110 = 6.
a(5) = 7 because OR(0101, 0010) = 0111 = 7.
		

Crossrefs

Cf. similar sequences listed in A244587.

Programs

Formula

a(n) = n + 1 + (-1)^floor(n/2).
G.f.: ( 2-x+x^3 ) / ( (1+x^2)*(x-1)^2 ). - R. J. Mathar, Feb 27 2013
Sum_{n>=0} (-1)^n/a(n) = Pi/4 - log(2)/2 = A196521. - Peter McNair, Aug 05 2023

A308880 Irregular array read by rows: row k (k>=1) contains k^2 numbers, formed by filling in a k X k square by rows so entries in all rows, columns, diagonals, antidiagonals are distinct, and then reading that square across rows.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jun 29 2019

Keywords

Comments

The second row of the k X k square converges to A004443 as k increases.
When filling in the k X k square, always choose the smallest possible number. Each k X k square is uniquely determined.
Each k X k square read downwards by antidiagonals up to and including the main antidiagonal is A274528(1..k*(k+1)/2). - I. V. Serov, Jun 30 2019, following an argument by Bernard Schott.

Examples

			The first eight squares are (here A=10, B=11, C=12):
0
--------
01
23
--------
012
230
145
--------
0123
2301
1452
5014
--------
01234
23015
14520
50143
36701
--------
012345
230167
145208
501436
376014
42957A
--------
0123456
2301674
1452083
5014362
3780145
4265798
9548237
--------
01234567
23016745
14520836
50143628
37801459
42675983
9548237A
A836BC92
--------
Concatenating the rows of these squares gives the sequence.
		

Crossrefs

Programs

  • MATLAB
    A308880 = [];
    A308881 = [];
    for n = 1:oo;
    M = [0:(n-1)
         zeros(n-1,n-0)*NaN];
    for i = 2:n; for j = 1:n; M = Mnext(M,n,i,j); end; end
    A308880 = [A308880 reshape(M',1,n^2)];
    A308881 = [A308881 reshape(M ,1,n^2)];
    end
    function [M] = Mnext(M,n,i,j);
    row = M(i,1:j-1);
    col = M(1:i-1,j);
    dim = diag(       M, j-i);
    dia = diag(fliplr(M),n-i-j+1);
    X = ([row col' dim' dia']);
    for m = 0:length(X)-1; if isempty(find(X==m)); break; end; end;
    M(i,j) = m;
    end
    % I. V. Serov, Jun 30 2019
Showing 1-10 of 12 results. Next