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

A002981 Numbers k such that k! + 1 is prime.

Original entry on oeis.org

0, 1, 2, 3, 11, 27, 37, 41, 73, 77, 116, 154, 320, 340, 399, 427, 872, 1477, 6380, 26951, 110059, 150209, 288465, 308084, 422429
Offset: 1

Views

Author

Keywords

Comments

If n + 1 is prime then (by Wilson's theorem) n + 1 divides n! + 1. Thus for n > 2 if n + 1 is prime n is not in the sequence. - Farideh Firoozbakht, Aug 22 2003
For n > 2, n! + 1 is prime <==> nextprime((n+1)!) > (n+1)nextprime(n!) and we can conjecture that for n > 2 if n! + 1 is prime then (n+1)! + 1 is not prime. - Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Mar 03 2004
The prime members are in A093804 (numbers n such that Sum_{d|n} d! is prime) since Sum_{d|n} d! = n! + 1 if n is prime. - Jonathan Sondow
150209 is also in the sequence, cf. the link to Caldwell's prime pages. - M. F. Hasler, Nov 04 2011

Examples

			3! + 1 = 7 is prime, so 3 is in the sequence.
		

References

  • J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 116, p. 40, Ellipses, Paris 2008.
  • Harvey Dubner, Factorial and primorial primes, J. Rec. Math., 19 (No. 3, 1987), 197-203.
  • Richard K. Guy, Unsolved Problems in Number Theory, Section A2.
  • F. Le Lionnais, Les Nombres Remarquables, Paris, Hermann, 1983, p. 100.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 118.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 70.

Crossrefs

Cf. A002982 (n!-1 is prime), A064295. A088332 gives the primes.
Equals A090660 - 1.
Cf. A093804.

Programs

  • Magma
    [n: n in [0..800] | IsPrime(Factorial(n)+1)]; // Vincenzo Librandi, Oct 31 2018
    
  • Mathematica
    v = {0, 1, 2}; Do[If[ !PrimeQ[n + 1] && PrimeQ[n! + 1], v = Append[v, n]; Print[v]], {n, 3, 29651}]
    Select[Range[100], PrimeQ[#! + 1] &] (* Alonso del Arte, Jul 24 2014 *)
  • PARI
    for(n=0,500,if(ispseudoprime(n!+1),print1(n", "))) \\ Charles R Greathouse IV, Jun 16 2011
    
  • Python
    from sympy import factorial, isprime
    for n in range(0,800):
        if isprime(factorial(n)+1):
            print(n, end=', ') # Stefano Spezia, Jan 10 2019

Extensions

a(19) sent in by Jud McCranie, May 08 2000
a(20) from Ken Davis (kraden(AT)ozemail.com.au), May 24 2002
a(21) found by PrimeGrid around Jun 11 2011, submitted by Eric W. Weisstein, Jun 13 2011
a(22) from Rene Dohmen, Jun 09 2012
a(23) from Rene Dohmen, Jan 12 2022
a(24)-a(25) from Dmitry Kamenetsky, Jun 19 2024

A002982 Numbers k such that k! - 1 is prime.

Original entry on oeis.org

3, 4, 6, 7, 12, 14, 30, 32, 33, 38, 94, 166, 324, 379, 469, 546, 974, 1963, 3507, 3610, 6917, 21480, 34790, 94550, 103040, 147855, 208003
Offset: 1

Views

Author

Keywords

Comments

The corresponding primes n!-1 are often called factorial primes.

Examples

			From _Gus Wiseman_, Jul 04 2019: (Start)
The sequence of numbers n! - 1 together with their prime indices begins:
                    1: {}
                    5: {3}
                   23: {9}
                  119: {4,7}
                  719: {128}
                 5039: {675}
                40319: {9,273}
               362879: {5,5,430}
              3628799: {10,11746}
             39916799: {6,7,9,992}
            479001599: {25306287}
           6227020799: {270,256263}
          87178291199: {3610490805}
        1307674367999: {7,11,11,16,114905}
       20922789887999: {436,318519035}
      355687428095999: {8,21,10165484947}
     6402373705727999: {17,20157,25293727}
   121645100408831999: {119,175195,4567455}
  2432902008176639999: {11715,659539127675}
(End)
		

References

  • J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 166, p. 53, Ellipses, Paris 2008.
  • R. K. Guy, Unsolved Problems in Number Theory, Section A2.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 118.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See entry 719 at p. 160.

Crossrefs

Cf. A002981 (numbers n such that n!+1 is prime).
Cf. A055490 (primes of form n!-1).
Cf. A088332 (primes of form n!+1).

Programs

Extensions

21480 sent in by Ken Davis (ken.davis(AT)softwareag.com), Oct 29 2001
Updated Feb 26 2007 by Max Alekseyev, based on progress reported in the Carmody web site.
Inserted missing 21480 and 34790 (see Caldwell). Added 94550, discovered Oct 05 2010. Eric W. Weisstein, Oct 06 2010
103040 was discovered by James Winskill, Dec 14 2010. It has 471794 digits. Corrected by Jens Kruse Andersen, Mar 22 2011
a(26) = 147855 from Felix Fröhlich, Sep 02 2013
a(27) = 208003 from Sou Fukui, Jul 27 2016

A005657 a(n) = floor( tan(n)^2 ).

Original entry on oeis.org

0, 2, 4, 0, 1, 11, 0, 0, 46, 0, 0, 51053, 0, 0, 52, 0, 0, 12, 1, 0, 5, 2, 0, 2, 4, 0, 1, 10, 0, 0, 41, 0, 0, 5672, 0, 0, 60, 0, 0, 13, 1, 0, 5, 2, 0, 2, 4, 0, 1, 10, 0, 0, 36, 0, 0, 2041, 0, 0, 69, 0, 0, 14, 1, 0, 5, 2, 0, 2, 4, 0, 1, 9, 0, 0, 32, 0, 0, 1041, 0, 0, 81, 0, 0, 15, 1, 0, 5, 2, 0, 2, 3, 0, 1, 8, 0, 0, 29, 0, 0, 629
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Magma
    [Floor(Tan(n)^2): n in [0..100]]; // Vincenzo Librandi, Jun 15 2015
  • Maple
    seq(floor(tan(n)^2),n=0..1000); # Robert Israel, Jun 14 2015
  • Mathematica
    Floor[Tan[Range[0,70]]^2] (* Harvey P. Dale, Nov 06 2011 *)
  • PARI
    vector(100, n, n--; floor(tan(n)^2)) \\ Michel Marcus, Jun 15 2015
    

Formula

a(n) = A005699(n)-1 for n >= 1.

A005654 Number of bracelets (turn over necklaces) with n red, 1 pink and n-1 blue beads; also reversible strings with n red and n-1 blue beads; also next-to-central column in Losanitsch's triangle A034851.

Original entry on oeis.org

1, 2, 6, 19, 66, 236, 868, 3235, 12190, 46252, 176484, 676270, 2600612, 10030008, 38781096, 150273315, 583407990, 2268795980, 8836340260, 34461678394, 134564560988, 526024917288, 2058358034616, 8061901596814, 31602652961516, 123979635837176, 486734861612328
Offset: 1

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A034851.

Programs

  • Magma
    [((Binomial(2*n-1, n)+Binomial(n-1, Floor(n/2)))/2): n in [1..30]]; // Vincenzo Librandi, May 24 2012
  • Maple
    A005654:=n->(1/2)*(binomial(2*n-1,n)+binomial(n-1,floor(n/2))): seq(A005654(n), n=1..40); # Wesley Ivan Hurt, Jan 29 2017
  • Mathematica
    Table[(Binomial[2n-1,n]+Binomial[n-1,Floor[n/2]])/2,{n,30}] (* Harvey P. Dale, May 17 2012 *)
  • PARI
    C(n,k)=binomial(n,k)
    a(n)=(1/2)*(C(2*n-1,n)+C(n-1,n\2))
    

Formula

a(n) = (1/2) * (binomial(2*n-1, n) + binomial(n-1, floor(n/2))). - Michael Somos
a(n) = A034851(2*n-1, n-1).
Conjecture: n*(n-2)*a(n) - (5*n-3)*(n-2)*a(n-1) + 4*(n-2)*a(n-2) + 4*(5*n^2-27*n+37)*a(n-3) - 8*(2*n-7)*(n-4)*a(n-4) = 0. - R. J. Mathar, Nov 09 2013

Extensions

Sequence extended and description corrected by Christian G. Bower

A213942 a(n) is the number of representative two-color bracelets (necklaces with turnover allowed) with n beads for n >= 2.

Original entry on oeis.org

1, 1, 3, 3, 7, 8, 18, 22, 46, 62, 136, 189, 409, 611, 1344, 2055, 4535, 7154, 15881, 25481, 56533, 92204, 204759, 337593, 748665, 1246862, 2762111, 4636389, 10253938, 17334800, 38278784, 65108061, 143534770, 245492243, 540353057, 928772649, 2041154125
Offset: 2

Views

Author

Wolfdieter Lang, Jul 31 2012

Keywords

Comments

This is the second column (m=2) of triangle A213940.
The relevant floor(n/2) representative color multinomials are c[1]^(n-1)*c[2], c[1]^(n-2)*c[2]^2, ..., c[1]^(n-floor(n/2))* c[2]^(floor(n/2)). For such representative bracelets the color c[1] is therefore preferred. Only for even n can c[2] appear as often as c[1], namely, n/2 times.
Note that beads with different colors are always present. This is in contrast to, e.g., A000029, where not only representatives but also one-color bracelets are counted. This sequences gives the number of binary bracelets with at least as many 0's as 1's and at least one 1 (bracelet analog of A226881). The number of two-color bracelets up to permutations of colors is given by A056357. For odd n these two sequences are equal. For a(8), the bracelets 00011011 and 11100100 are equivalent in A056357 but distinct in this sequence. - Andrew Howroyd and Wolfdieter Lang, Sep 25 2017

Examples

			a(5) = A213939(5,2) + A213939(5,3) = 1 + 2 = 3 from the representative bracelets (with colors j for c[j], j=1,2) cyclic(11112), cyclic(11122) and cyclic(11212). The first one has color signature (exponents) [4,1] and the two others have signature [3,2]. For the number of all two-color 5-bracelets with beads of five colors available see A214308(5) = 60.
a(8) = 18 =  1 + 4 + 5 + 8 for the partitions of 8 with 2 parts (7,1), (6, 2), (5,3), (4,4), respectively. see A213939(5, k), k = 2..5). The 8 representative bracelets for the exponents (signature) from partition (4,4) are B1 = (11112222), B2 = (11121222), B3 = (11212122), B4 = (11212212), B5 = (11221122), B6 = (12121212), B7 = (11122122) and B8 = (11211222). B1 to B6 are color exchange (1 <-> 2) invariant (modulo D_8 symmetry, i.e., cyclic or anti-cyclic operations). B7 is equivalent to B8 under color exchange.
This explains why A056357(8) = 17. The difference between the present sequence and A056357 is that there, besides D_n symmetry, also color exchange is allowed. Here only color exchange compatible with D_n symmetry is allowed. - _Wolfdieter Lang_, Sep 28 2017
		

Crossrefs

Cf. A213939, A213940, A214307 (m=3), A214308 (m=2, all bracelets).

Programs

  • Mathematica
    a29[n_] := (1/4)*(Mod[n, 2] + 3)*2^Quotient[n, 2] + DivisorSum[n, EulerPhi[#]*2^(n/#)&]/(2*n);
    a5648[n_] := 1/2*(Binomial[2*Quotient[n, 2], Quotient[n, 2]] + DivisorSum[n, EulerPhi[#]*Binomial[2*n/#, n/#]&]/(2*n));
    a[n_] := a29[n]/2 - 1 + If[EvenQ[n], a5648[n/2]/2, 0];
    Array[a, 37, 2] (* Jean-François Alcover, Nov 05 2017, after Andrew Howroyd *)

Formula

a(n) = A213940(n,2), n >= 2.
a(n) = Sum_{k=2..A008284(n,2)+1} A213939(n,k), n >= 2, with A008284(n,2) = floor(n/2).
a(2n) = (A000029(2n) + A005648(n)) / 2 - 1, a(2n+1) = A000029(2n+1) / 2 - 1. - Andrew Howroyd, Sep 25 2017

Extensions

Terms a(26) and beyond from Andrew Howroyd, Sep 25 2017

A005656 Number of bracelets (turn over necklaces) with n red, 1 pink and n - 3 blue beads; also reversible strings with n red and n-3 blue beads.

Original entry on oeis.org

0, 0, 1, 3, 12, 44, 170, 651, 2520, 9752, 37854, 147070, 572264, 2229096, 8692788, 33933459, 132594480, 518584880, 2029976630, 7952706234, 31179618184, 122331419080, 480283635468, 1886828198398
Offset: 1

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

a(n) = A034851(2n-3, n-3).

Programs

  • Magma
    [(1/2)*(Binomial(2*n-3, n-3) + Binomial(n-2, Floor((n-3)/2))): n in [1..30]]; // Vincenzo Librandi, Oct 08 2017
  • Maple
    A005656:=n->(1/2)*(binomial(2*n-3, n-3) + binomial(n-2, floor((n-3)/2))): seq(A005656(n), n=1..30); # Wesley Ivan Hurt, Oct 06 2017
  • Mathematica
    Table[(1/2) (Binomial[2 n - 3, n - 3] + Binomial[n - 2, Floor[(n - 3) / 2]]), {n, 40}] (* Vincenzo Librandi, Oct 08 2017 *)
  • PARI
    C(n,k)= if(k<0||k>n,0,n!/k!/(n-k)!);
    a(n)= (1/2) *(C(2*n-3,n-3)+C(n-2,(n-3)\2));
    

Formula

a(n) = (1/2)*(binomial(2*n - 3, n - 3) + binomial(n - 2, floor((n - 3)/2))). - Michael Somos

Extensions

Sequence corrected, extended and description corrected by Christian G. Bower

A045628 Number of 2n-bead black-white reversible necklaces with n black beads and fundamental period 2n.

Original entry on oeis.org

1, 1, 1, 2, 6, 15, 46, 132, 432, 1384, 4735, 16158, 56766, 200473, 718012, 2587000, 9398080, 34324173, 126067124, 465093570, 1723171550, 6407924165, 23910560070, 89494164972, 335913861648, 1264107416450, 4768452532025
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A005648.

Programs

  • Mathematica
    a[n_] := If[n == 0, 1, Sum[MoebiusMu[n/d] (2n Binomial[ 2 Quotient[d, 2], Quotient[d, 2]] + Binomial[2d, d]), {d, Divisors[n]}]/(4n)];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Aug 28 2019, from PARI *)
  • PARI
    a(n) = if(n<1, n==0, sumdiv(n,d, moebius(n/d)*(2*n*binomial(2*(d\2), d\2) + binomial(2*d, d)))/(4*n)); \\ Andrew Howroyd, Sep 28 2017

Formula

Moebius transform of A005648. - Christian G. Bower
a(n) = 1/(4*n) * Sum_{d|n} mu(n/d) * (2*n*binomial(2*floor(d/2), floor(d/2)) + binomial(2*d, d)) for n > 0. - Andrew Howroyd, Sep 28 2017

A073020 Triangle of T(n,m) = number of bracelets (necklaces than can be turned over) with m white beads and (2n-m) black ones, for 1<=m<=n.

Original entry on oeis.org

1, 1, 2, 1, 3, 3, 1, 4, 5, 8, 1, 5, 8, 16, 16, 1, 6, 12, 29, 38, 50, 1, 7, 16, 47, 79, 126, 133, 1, 8, 21, 72, 147, 280, 375, 440, 1, 9, 27, 104, 252, 561, 912, 1282, 1387, 1, 10, 33, 145, 406, 1032, 1980, 3260, 4262, 4752, 1, 11, 40, 195, 621, 1782, 3936, 7440, 11410
Offset: 1

Views

Author

Wouter Meeussen, Aug 03 2002

Keywords

Comments

Left half of even rows of table A052307 with left column deleted.

Examples

			1; 1,2; 1,3,3; 1,4,5,8; 1,5,8,16,16; ...
		

Crossrefs

Cf. A052307, A047996, A072506, A005648. Cf. A078925 for odd number of beads. Last term in each row gives A005648.

Programs

  • Mathematica
    Table[Length[ Union[Last[Sort[Flatten[Table[{RotateLeft[ #, i], Reverse[RotateLeft[ #, i]]}, {i, 2k}], 1]]]& /@ Permutations[IntegerDigits[2^(2k-j) (2^j-1), 2]]] ], {k, 9}, {j, k}]
    Table[( -(-1)^n If[EvenQ[m+n], 0, Binomial[n-1, Floor[(m-2)/2]] ]/2 + Fold[ #1+EulerPhi[ #2]Binomial[2n/#2, m/#2]/(2n)&, Binomial[2Floor[n/2], Floor[m/2]], Intersection[Divisors[2n], Divisors[m]]]/2), {n, 9}, {m, n}]
    Table[ f[k, 2n], {n, 11}, {k, n}] // Flatten (* Robert G. Wilson v, Mar 29 2006 *)

Formula

(1/2)*(C(2*(n\2), m\2) +Sum (d|(2n, m) phi(d)C(2n/d, m/d) ) - (-1)^n if(even(n+m), 0, C(n-1, floor(m/2-1/2) ).

A103692 Row sums of A103691.

Original entry on oeis.org

1, 2, 4, 6, 11, 16, 24, 44, 59, 124, 122, 372, 357, 966, 898, 3926, 1634, 13660, 6207, 32656
Offset: 2

Views

Author

Wouter Meeussen, Feb 12 2005

Keywords

Crossrefs

Programs

  • Mathematica
    (* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) f[bi_] := DeleteCases[ bi*Range[ Length[bi]], 0]; vec[li_, l_]:= Abs[Plus @@ N[Exp[2*Pi*I*f[li]/l], 24]]; Plus @@@ Table[ Length[ Union[(vec[ #, n]&)/@ ListNecklaces[n, Join[1+0*Range[i], 0*Range[n-i]], Dihedral], SameTest ->(Abs[ #1 - #2] < 10^-18 &)]], {n, 2, 17}, {i, n-1}]

Extensions

a(17)-a(21) from Robert G. Wilson v, Feb 14 2005

A005655 Number of board configurations in Mu Torere (for one player).

Original entry on oeis.org

1, 3, 6, 15, 46, 148, 522, 1869, 6910, 25767, 97256, 369127, 1409362, 5401698, 20778162, 80149210, 309945150, 1201140154, 4663660518, 18137774091, 70646533096, 275537046276, 1075960410806, 4206210234205, 16459717112530, 64469413339498, 252727724406852
Offset: 0

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    a[0] = 1; a[n_] := (1/2)*(Binomial[ 2*Quotient[n, 2], Quotient[n, 2]] + 2*(Binomial[ 2n-1, n] + Binomial[ n-1, Quotient[n, 2]]) + Sum[ EulerPhi[n/k] * Binomial[2k, k]/(2n), {k, Divisors[n]}]); Table[ a[n], {n, 0, 24}] (* Jean-François Alcover, Jan 27 2012, after PARI *)
  • PARI
    C(n,k)=if(k<0||k>n,0,n!/k!/(n-k)!);
    a(n)= (1/2) *( C(2*(n\2), n\2) + 2*(C(2*n-1,n)+C(n-1,n\2)) + if(n<1,n >= 0,sumdiv(n,k,eulerphi(n/k)*C(2*k,k))/(2*n)) )

Formula

a(n) = 2*A005654(n) + A005648(n).

Extensions

Better description and more terms from Michael Somos
Showing 1-10 of 12 results. Next