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

A069191 Determinant of n X n matrix defined by m(i,j)=1 if i+j is a prime, m(i,j)=0 otherwise.

Original entry on oeis.org

1, -1, -1, 0, 1, -1, -4, 4, 0, 0, 0, 0, 0, 0, 0, 4, 4, -9, -25, 121, 64, -576, -2304, 3600, 3136, -256, -144, 961, 24025, -47089, -345744, 1317904, 107584, -26896, -30976, 17424, 30976, -156025, -76729, 485809, 478864, -36481, -837225, 5776, 517198564, -15791440896, -16404230241, 45746793225
Offset: 1

Views

Author

Santi Spadaro, Apr 19 2002

Keywords

Comments

Abs(a(n)) is always a perfect square.
A general result for Hankel determinants: Given any sequence a(0),a(1),... of numbers, let the n X n Hankel matrix A[i,j]=x if i=j=0, 0 if i+j even and a(((i+j)-1)/2) otherwise where 0<=i,jMichael Somos
Conjecture: Let M(n) be the n X n matrix with (i,j)-entry equal to 1 or 0 according as i + j is prime or not. For each n = 24, 25, ..., the characteristic polynomial of M(n) is irreducible over the field of rational numbers, and the n eigenvalues can be listed as lambda(1), ..., lambda(n) such that lambda(1) > -lambda(2) > lambda(3) > -lambda(4) > .... > (-1)^n*lambda(n) > 0. - Zhi-Wei Sun, Aug 25 2013
That (-1)^(n(n-1)/2)*a(n) is a perfect square is a special case of a general theorem mentioned in A228591. - Zhi-Wei Sun, Aug 25 2013

Crossrefs

Cf. A073364.

Programs

  • Mathematica
    f[n_] := Det[ Table[ If[ PrimeQ[i + j], 1, 0], {i, 1, n}, {j, 1, n}]]; Table[ f[n], {n, 1, 45}]

A097083 Positive values of k such that there is exactly one permutation p of (1,2,3,...,k) such that i+p(i) is a Fibonacci number for 1<=i<=k.

Original entry on oeis.org

1, 2, 3, 5, 9, 15, 24, 39, 64, 104, 168, 272, 441, 714, 1155, 1869, 3025, 4895, 7920, 12815, 20736, 33552, 54288, 87840, 142129, 229970, 372099, 602069, 974169, 1576239, 2550408, 4126647, 6677056, 10803704, 17480760, 28284464, 45765225
Offset: 1

Views

Author

John W. Layman, Jul 23 2004

Keywords

Comments

Numbers k such that A097082(k) = 1. If f is a Fibonacci number and k < f <= 2k, then a permutation for f-k-1 may be extended to a permutation for k, with p(i) = f-i for f-k < i <= k. This explains the sparseness of this sequence. - David Wasserman, Dec 19 2007
If the formula is correct, the bisections give A059840 and A064831. - David Wasserman, Dec 19 2007

Crossrefs

Programs

  • Mathematica
    a=b=c=d=0;Table[e=a+b+d+1;a=b;b=c;c=d;d=e,{n,100}] (* Vladimir Joseph Stephan Orlovsky, Feb 26 2011 *)
    CoefficientList[Series[x/((x - 1)*(x^2 + 1)*(x^2 + x - 1)), {x,0,50}], x] (* G. C. Greubel, Mar 05 2017 *)
    LinearRecurrence[{2,-1,1,0,-1},{1,2,3,5,9},50] (* Harvey P. Dale, Nov 09 2024 *)
  • PARI
    x='x+O('x^50); Vec(x/((x - 1)*(x^2 + 1)*(x^2 + x - 1))) \\ G. C. Greubel, Mar 05 2017

Formula

It appears that {a(n)} satisfies a(1)=1, a(2)=2 and, for n>2, a(n) = F(n+2) - a(n-2) - 1, where {F(k)} is the sequence of Fibonacci numbers, i.e, that the sequence is the partial sums of A006498.
If the partial sum assumption is correct: a(n) = floor(phi^(n+3)/5), where phi=(1+sqrt(5))/2 = A001622, and a(n) = a(n-1) + a(n-2) + ( (n*(n+1)/2) mod 2). - Gary Detlefs, Mar 12 2011
From R. J. Mathar, Mar 13 2011: (Start)
If the partial sum assumption is correct: a(n)= +2*a(n-1) -a(n-2) +a(n-3) -a(n-5).
G.f.: x/( (x-1)*(x^2+1)*(x^2+x-1) ).
a(n) = A000032(n+3)/5 -(-1)^n*A112030(n)/10 - 1/2. (End)
Conjecture: a(n) = floor(F(n+3)/sqrt(5)), where F(n) = A000045(n) are Fibonacci numbers. - Vladimir Reshetnikov, Nov 05 2015

Extensions

a(9) from Ray Chandler, Jul 29 2004
More terms from David Wasserman, Dec 19 2007
Terms > 90000 assuming the partial sums formula by Vladimir Joseph Stephan Orlovsky, Feb 26 2011

A070897 Number of ways of pairing numbers 1 to n with numbers n+1 to 2n such that each pair sums to a prime.

Original entry on oeis.org

1, 1, 1, 1, 2, 4, 8, 36, 40, 49, 126, 121, 440, 2809, 11395, 32761, 132183, 881721, 3015500, 19642624, 106493895, 249987721, 1257922092, 4609187881, 29262161844, 189192811369, 1068996265025, 7388339422500, 67416357342087, 465724670229025, 1979950199225010
Offset: 1

Views

Author

T. D. Noe, May 23 2002

Keywords

Examples

			a(5)=2 because there are two ways: 1+10, 2+9, 3+8, 4+7, 6+5 and 1+6, 2+9, 3+10, 4+7, 5+8.
		

Crossrefs

Programs

  • Haskell
    import Data.List (permutations)
    a070897 n = length $ filter (all ((== 1) . a010051))
                         $ map (zipWith (+) [1..n]) (permutations [n+1..2*n])
    -- Reinhard Zumkeller, Mar 19 2011, Apr 16 2011 (fixed)
    
  • Mathematica
    <n ]& /@Select[ Range[ n+2, 3*n ], PrimeQ ], 1 ]; po=Position[ it, # ]&/@Range[ n ]; permoid=(Extract[ it, # ]-n)& /@(po /. {i_Integer, j_}->{i, 1} ); Length@Backtrack[ permoid, UnsameQ@@#&, Length[ # ]===n&, All ] ]; Noe/@Range[ 2, 16 ] (* from Wouter Meeussen *)
    a[n_] := Permanent[Table[If[PrimeQ[i+j+n], 1, 0], {i, n}, {j, n}]]; Table[ an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 16}] (* Jean-François Alcover, Feb 26 2016 *)
  • PARI
    a(n)=my(a071058=matpermanent(matrix((n+1)\2,(n+1)\2,i,j,isprime((i+j-2)*2+n+3-(n%2))))); if(n%2==0, a071058^2, a071058*matpermanent(matrix(n\2,n\2,i,j,isprime((i+j-2)*2+n+3+(n%2))))); \\ Martin Fuller, Sep 21 2023

Formula

a(n) = permanent(m), where the n X n matrix m is defined by m(i,j) = 1 or 0, depending on whether i+j+n is prime or composite, respectively. - T. D. Noe, Feb 10 2007
a(n) = A071058(n) * A071059(n).

Extensions

More terms from Don Reble, May 26 2002

A095986 A card-arranging problem: number of permutations p_1, ..., p_n of 1, ..., n such that i + p_i is a square for every i.

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 2, 4, 3, 2, 5, 15, 21, 66, 37, 51, 144, 263, 601, 1333, 2119, 2154, 2189, 3280, 12405, 55329, 160895, 588081, 849906, 1258119, 1233262, 2478647, 4305500, 17278636, 47424179, 153686631, 396952852, 1043844982
Offset: 0

Views

Author

Keywords

Comments

Gardner attributes the problem (for the case n = 13) to David L. Silverman.

Examples

			a(0) = 1: the empty permutation.
a(3) = 1: 321.
a(5) = 1: 32154.
a(8) = 1: 87654321.
a(9) = 1: 826543917.
		

References

  • M. Gardner, Mathematical Games column, Scientific American, Nov 1974.
  • M. Gardner, Mathematical Games column, Scientific American, Mar 1975.
  • M. Gardner, Time Travel and Other Mathematical Bewilderments. Freeman, NY, 1988, p. 81.

Crossrefs

Cf. A006063 (for cubes), A010052, A073364.

Programs

  • Maple
    b:= proc(s) option remember; (n-> `if`(n=0, 1, add(
         `if`(issqr(n+j), b(s minus {j}), 0), j=s)))(nops(s))
        end:
    a:= n-> b({$1..n}):
    seq(a(n), n=0..25);  # Alois P. Heinz, Mar 03 2024
  • Mathematica
    nmax=45; a[n_]:=Permanent[Table[If[IntegerQ[Sqrt[i+j]],1,0],{i,n},{j,n}]]; Join[{1},Array[a,nmax]] (* Stefano Spezia, Mar 03 2024 *)

Formula

a(n) = permanent(m), where the n X n matrix m is defined by m(i,j) = 1 or 0, depending on whether i+j is a square or not.

Extensions

a(32) and a(33) from John W. Layman, Jul 21 2004
a(34)-a(36) from Ray Chandler, Jul 26 2004
a(37)-a(45) from William Rex Marshall, Apr 18 2006
a(0)=1 prepended by Alois P. Heinz, Mar 03 2024

A097082 Number of permutations p of (1,2,3,...,n) such that k+p(k) is a Fibonacci number for 1 <= k <= n.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 2, 4, 2, 1, 4, 4, 20, 4, 5, 1, 20, 24, 8, 96, 200, 24, 4, 25, 1, 3, 200, 48, 288, 48, 64, 2304, 1600, 10800, 288, 432, 8, 675, 650, 1, 26, 9, 10400, 1600, 576, 2304, 23040, 576, 2560, 1024, 368640, 516096, 128000, 2240000, 5832000, 32256, 2304, 46656, 64, 96, 91125, 3750, 84500, 6, 1, 676, 9, 261
Offset: 0

Views

Author

John W. Layman, Jul 23 2004

Keywords

Comments

See A097083 for the positive values of n such that a(n) = 1.

Crossrefs

Programs

  • Mathematica
    nmax=67; A010056[n_]:=With[{fibs=Fibonacci[Range[nmax]]}, If[MemberQ[fibs, n], 1, 0]]; a[n_]:=Permanent[Table[If[A010056[i+j]==1,1,0],{i,n},{j,n}]]; Join[{1},Array[a,nmax]] (* Stefano Spezia, Mar 03 2024 *)

Formula

a(n) = permanent(m), where the n X n matrix m is defined by m(i,j) = 1 or 0 depending on whether i+j is a Fibonacci number or not.

Extensions

a(30)-a(50) from Ray Chandler, Jul 26 2004
More terms from David Wasserman, Dec 19 2007
a(0)=1 prepended by Stefano Spezia, Mar 04 2024

A096680 A card-arranging problem: values of n such that there exists more than one permutation p_1, ..., p_n of 1, ..., n such that i + p_i is a cube for every i.

Original entry on oeis.org

112, 115, 116, 117, 119, 124, 125, 126, 127, 128, 129, 130, 133, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212
Offset: 1

Views

Author

Ray Chandler, Jul 25 2004

Keywords

Examples

			117 is in the sequence with permutations
(7,6,...,2,1,117,116,...,9,8) and
(26,25,...,2,1,98,97,...28,27,117,116,...,100,99)
		

Crossrefs

A134293 Number of ways to pair up {2..2n+1} so the sum of each pair is prime.

Original entry on oeis.org

1, 1, 2, 6, 20, 60, 190, 764, 2337, 9812, 49538, 330058, 2133438, 11192143, 73469550, 462692414, 3692965270, 32635321384, 290171883863, 2572828730372, 22299380503953, 195129375058656, 1544534855847233, 13144353749969945, 128883813733449772, 1365629506139662111
Offset: 1

Views

Author

T. D. Noe, Oct 17 2007

Keywords

Comments

This sequence complements A000341, which is also related to A073364.

Examples

			a(3)=2 because for the set {2..7} there are two ways: {{2,3},{4,7},{5,6}} and {{2,5},{3,4},{6,7}}.
		

Programs

  • Mathematica
    a[n_] := Permanent[Array[Boole[PrimeQ[2 #1 + 2 #2 + 1]]&, {n, n}]];
    Array[a, 15] (* Jean-François Alcover, Nov 03 2018 *)
  • PARI
    a(n)={matpermanent(matrix(n,n,i,j,isprime(2*i + 2*j + 1)))} \\ Andrew Howroyd, Nov 03 2018

Formula

a(n) = permanent(m), where the n X n matrix m is defined by m(i,j) = 1 or 0, depending on whether 2i+2j+1 is prime or composite, respectively.

Extensions

a(21)-a(26) from Andrew Howroyd, Nov 03 2018

A276986 Numbers n for which there is a permutation p of (1,2,3,...,n) such that k+p(k) is a Catalan number for 1<=k<=n.

Original entry on oeis.org

0, 1, 3, 4, 9, 10, 12, 13, 28, 29, 31, 32, 37, 38, 40, 41, 90, 91, 93, 94, 99, 100, 102, 103, 118, 119, 121, 122, 127, 128, 130, 131, 297, 298, 300, 301, 306, 307, 309, 310, 325, 326, 328, 329, 334, 335, 337, 338, 387, 388, 390, 391, 396, 397, 399, 400, 415, 416
Offset: 1

Views

Author

Gary E. Davis, Sep 24 2016

Keywords

Comments

A001453 is a subsequence. - Altug Alkan, Sep 29 2016
n>=1 is in the sequence if and only if there is a Catalan number c such that c/2 <= n < c and c-n-1 is in the sequence. - Robert Israel, Nov 20 2016

Examples

			3 is in the sequence because the permutation (1,3,2) added termwise to (1,2,3) yields (2,5,5) and both 2 and 5 are Catalan numbers.
		

Crossrefs

Programs

  • Maple
    S:= {0}:
    for i from 1 to 8 do
      c:= binomial(2*i,i)/(i+1);
      S:= S union map(t -> c - t - 1, S);
    od:
    sort(convert(S,list)); # Robert Israel, Nov 20 2016
  • Mathematica
    CatalanTo[n0_] :=
    Module[{n = n0}, k = 1; L = {};
      While[CatalanNumber[k] <= 2*n, L = {L, CatalanNumber[k]}; k++];
      L = Flatten[L]]
    perms[n0_] := Module[{n = n0, S, func, T, T2},
      func[k_] := Cases[CatalanTo[n], x_ /; 1 <= x - k <= n] - k;
      T = Tuples[Table[func[k], {k, 1, n}]];
      T2 = Cases[T, x_ /; Length[Union[x]] == Length[x]];
      Length[T2]]
    Select[Range[41], perms[#] > 0 &]

Formula

a(i) + a(2^n+1-i) = A000108(n+1)-1 for 1<=i<=2^n. - Robert Israel, Nov 20 2016

Extensions

More terms from Alois P. Heinz, Sep 28 2016
a(23)-a(58) from Robert Israel, Nov 18 2016

A096901 Number of permutations p of (1,2,3,...,n) such that k+p(k) is a triangular number for 1<=k<=n.

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 1, 1, 2, 4, 3, 9, 14, 13, 52, 124, 161, 181, 715, 2338, 7073, 8624, 15466, 52858, 150365, 316543, 691771, 1681604, 5324919, 15407311, 37417775, 69725286, 155786456, 579599171, 2600274145, 10530031625, 22971756045, 47057778714, 112946192928
Offset: 0

Views

Author

Ray Chandler, Jul 26 2004

Keywords

Crossrefs

Formula

a(n) = permanent(m), where the n X n matrix m is defined by m(i,j) = 1 or 0, depending on whether i+j is a triangular number or not.

Extensions

More terms from David Wasserman, Nov 27 2007
a(0) and a(31)-a(38) from Martin Ehrenstein, Mar 03 2024

A276735 Number of permutations p of (1..n) such that k+p(k) is a semiprime for 1 <= k <= n.

Original entry on oeis.org

1, 0, 0, 1, 1, 3, 5, 12, 87, 261, 324, 1433, 5881, 37444, 196797, 708901, 2020836, 12375966, 105896734, 955344450, 11136621319, 95274505723, 590283352231, 4285001635230, 36417581252044, 272699023606314
Offset: 0

Views

Author

Gary E. Davis, Sep 24 2016

Keywords

Examples

			a(4) = 1 because the permutation (3,4,1,2) added termwise to (1,2,3,4) yields (4,6,4,6) - both semiprimes - and only that permutation does so. a(5) = 3 because exactly 3 permutations - (3,2,1,5,4), (3,4,1,2,5) & (5,4,3,2,1) - added termwise to (1,2,3,4,5) yield semiprime entries.
From _David A. Corneth_, Sep 28 2016 (Start):
The semiprimes up to 10 are 4, 6, 9 and 10. To find a(5), we add (1,2,3,4,5) to some p. Therefore, p(1) in {3, 5}, p(2) in {2, 4}, p(3) in {1, 3}, p(4) in {2, 5} and p(5) in {1, 4, 5}.
If p(1) = 3 then p(3) must be 1. Then {p(2), p(4), p(5)} = {2, 4, 5} for which there are two possibilities.
If p(1) = 5 then p(3) = 3 and p(4) = 2. Then p(2) = 4 and p(5) = 1. So there's one permutation for which p(1) = 5.
This exhausts the options for p(1) and we found 3 permutations. Therefore, a(5) = 3. (End)
		

Crossrefs

Programs

  • Maple
    with(LinearAlgebra): with(numtheory):
    a:= n-> `if`(n=0, 1, Permanent(Matrix(n, (i, j)->
            `if`((s-> bigomega(s)=2)(i+j), 1, 0)))):
    seq(a(n), n=0..16);  # Alois P. Heinz, Sep 28 2016
  • Mathematica
    perms[n0_] :=
    Module[{n = n0, S, func, T, T2},
      S = Select[Range[2, 2*n], PrimeOmega[#] == 2 &];
      func[k_] := Cases[S, x_ /; 1 <= x - k <= n] - k;
      T = Tuples[Table[func[k], {k, 1, n}]];
      T2 = Cases[T, x_ /; Length[Union[x]] == Length[x]];
      Length[T2]]
    Table[perms[n], {n, 0, 12}]
    (* Second program (version >= 10): *)
    a[0] = 1; a[n_] := Permanent[Table[Boole[PrimeOmega[i + j] == 2], {i, 1, n}, {j, 1, n}]]; Table[an = a[n]; Print[an]; an, {n, 0, 20}] (* Jean-François Alcover, Jul 25 2017 *)
  • PARI
    isok(va, vb)=my(v = vector(#va, j, va[j]+vb[j])); #select(x->(bigomega(x) == 2), v) == #v;
    a(n) = my(vpo = numtoperm(n,1)); sum(k=1, n!, vp = numtoperm(n,k); isok(vp, vpo)); \\ Michel Marcus, Sep 24 2016
    
  • PARI
    listA001358(lim)=my(v=List()); forprime(p=2, sqrtint(lim\1), forprime(q=p, lim\p, listput(v, p*q))); Set(v)
    has(v)=for(k=1,#v, if(!setsearch(semi, v[k]+k), return(0))); 1
    a(n)=local(semi=listA001358(2*n)); sum(k=1,n!, has(numtoperm(n,k))) \\ Charles R Greathouse IV, Sep 28 2016
    
  • PARI
    matperm(M)=my(n=matsize(M)[1], innerSums=vectorv(n)); if(n==0, return(1)); sum(x=1,2^n-1, my(k=valuation(x,2), s=M[,k+1], gray=bitxor(x,x>>1)); if(bittest(gray,k), innerSums+=s,innerSums-=s); (-1)^hammingweight(gray)*factorback(innerSums))*(-1)^n
    a(n)=matperm(matrix(n,n,x,y,bigomega(x+y)==2)) \\ Charles R Greathouse IV, Oct 03 2016

Extensions

More terms from Alois P. Heinz, Sep 28 2016
Showing 1-10 of 11 results. Next