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 10 results.

A061007 a(n) = -(n-1)! mod n.

Original entry on oeis.org

0, 1, 1, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0
Offset: 1

Views

Author

Henry Bottomley, Apr 12 2001

Keywords

Comments

The following sequences all appear to have the same parity (with an extra zero term at the start of A010051): A010051, A061007, A035026, A069754, A071574. - Jeremy Gardiner, Aug 09 2002
In particular, this is identical to the isprime function A010051 except for a(4) = 2 instead of 0. This is equivalent to Wilson's theorem, (n-1)! == -1 (mod n) iff n is prime. If n = p*q with p, q > 1, then p, q < n-1 and (n-1)! will contain the two factors p and q, unless p = q = 2 (if p = q > 2 then also 2p < n-1, so there are indeed two factors p in (n-1)!), whence (n-1)! == 0 (mod n). - M. F. Hasler, Jul 19 2024

Examples

			a(4) = 2 since -(4 - 1)! = -6 = 2 mod 4.
a(5) = 1 since -(5 - 1)! = -24 = 1 mod 5.
a(6) = 0 since -(6 - 1)! = -120 = 0 mod 6.
		

Crossrefs

Positive for all but the first term of A046022.
Cf. A000040 (the primes), A000142, A010051 (isprime function), A055976, A061006, A061008, A061009.

Programs

Formula

a(4) = 2, a(p) = 1 for p prime, a(n) = 0 otherwise. Apart from n = 4, a(n) = A010051(n) = A061006(n)/(n-1).

A061008 a(n) = Sum_{j=1..n} (-(n-1)! mod n).

Original entry on oeis.org

0, 1, 2, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 23, 23, 23
Offset: 1

Views

Author

Henry Bottomley, Apr 12 2001

Keywords

Examples

			a(6) = 5 since (-1 mod 1) + (-1 mod 2) + (-2 mod 3) + (-6 mod 4) + (-24 mod 5) + (-120 mod 6) = 0 + 1 + 1 + 2 + 1 + 0 = 5.
		

Crossrefs

Programs

  • Magma
    [0,1,2] cat [ 2+#PrimesUpTo(n): n in [4..200] ]; // Vincenzo Librandi, Aug 11 2017
  • Mathematica
    Join[{0, 1, 2}, a[n_]:= 2 + PrimePi[n]; Table[a[n], {n, 4, 100}]] (* Vincenzo Librandi, Aug 11 2017 *)

Formula

a(n) = a(n-1) + A061007(n) = A061009(n) + 2. For n > 3, a(n) = pi(n) + 2 where pi(n) = A000720(n) is the number of primes less than or equal to n.

A061009 a(n) = -2 + Sum_{j=1..n} (-(n-1)!) mod n.

Original entry on oeis.org

-2, -1, 0, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24
Offset: 1

Views

Author

Henry Bottomley, Apr 12 2001

Keywords

Examples

			a(6)=3 since -2 + (-1 mod 1) + (-1 mod 2) + (-2 mod 3) + (-6 mod 4) + (-24 mod 5) + (-120 mod 6) = -2 + 0 + 1 + 1 + 2 + 1 + 0 = 3.
		

Crossrefs

Formula

a(n) = a(n-1) + A061007(n) = A061008(n) - 2. For n > 3, a(n) = pi(n) = A000720(n) where pi(n) is the number of primes less than or equal to n.

A119688 a(n) = n!! mod (n+1).

Original entry on oeis.org

1, 2, 3, 3, 3, 6, 1, 6, 5, 1, 3, 8, 7, 0, 1, 13, 9, 1, 15, 0, 11, 1, 9, 0, 13, 0, 7, 17, 15, 1, 1, 0, 17, 0, 27, 6, 19, 0, 25, 9, 21, 1, 11, 0, 23, 46, 33, 0, 25, 0, 39, 30, 27, 0, 49, 0, 29, 58, 15, 50, 31, 0, 1, 0, 33, 1, 51, 0, 35, 1, 9, 27, 37, 0, 19, 0, 39, 78, 65, 0, 41, 82, 63, 0
Offset: 1

Views

Author

Keywords

Comments

The double factorial used here is A006882, a(n) = n*a(n-2). Bisections of A006882 are A000165 and A001147.

Examples

			5!! = 5*3*1 = 15, a(5) = 15 mod (5+1) = 3.
6!! = 6*4*2 = 48, a(6) = 48 mod (6+1) = 6.
		

Crossrefs

Programs

  • Magma
    DoubleFactorial:=func< n | &*[n..2 by -2] >; [ DoubleFactorial(n) mod (n+1): n in [1..100] ]; // Klaus Brockhaus, Feb 15 2011
    
  • Maple
    P:= proc(n) local i, j, k, s; for k from 1 by 1 to n do i:=k; j:=k-2; while j >0 do i:=i*j; j:=j-2; od: s:=i mod (k+1); print(s); od: end: P(100);
    ## another version:
    a:= proc(n) local t, m;
           if irem (n, 2)=1 or n<14 or isprime(n+1)
           then t:= 1;
                for m from n by -2 while m>1 do
                  t:= (t*m) mod (n+1)
                od; t
           else 0 fi
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 15 2011
  • Mathematica
    Table[Mod[n!!,n+1],{n,100}] (* Zak Seidov, Feb 15 2011 *)
  • PARI
    a(n) = prod(i=0, (n-1)\2, n - 2*i) % (n+1); \\ after PARI for A006882; Michel Marcus, Aug 22 2016

Extensions

a(63) corrected, a(64) inserted by Klaus Brockhaus, Feb 15 2011

A238002 Count with multiplicity of prime factors of n in (n - 1)!.

Original entry on oeis.org

0, 0, 1, 0, 4, 0, 4, 2, 8, 0, 12, 0, 11, 7, 11, 0, 21, 0, 19, 10, 19, 0, 28, 4, 23, 10, 26, 0, 44, 0, 26, 16, 32, 11, 47, 0, 35, 19, 43, 0, 61, 0, 42, 28, 42, 0, 63, 6, 56, 24, 50, 0, 72, 16, 58, 28, 54, 0, 94, 0, 57, 37, 57, 18, 98, 0, 67, 33, 91, 0, 99, 0, 71, 50, 74, 17, 113, 0, 92
Offset: 2

Views

Author

Alonso del Arte, Feb 16 2014

Keywords

Examples

			a(4) = 1 because 3! = 6 = 2 * 3, which has one prime factor (2) in common with 4.
a(5) = 0 because gcd(4!, 5) = 1.
a(6) = 4 because 5! = 120 = 2^3 * 3 * 5, which has four factors (2 thrice and 3 once) in common with 6.
		

Crossrefs

Programs

  • Maple
    with(numtheory):
    a:= n-> add(add(`if`(i[1] in factorset(n), i[2], 0),
            i=ifactors(j)[2]), j=1..n-1):
    seq(a(n), n=2..100);  # Alois P. Heinz, Mar 17 2014
  • Mathematica
    cmpf[n_]:=Count[Flatten[Table[#[[1]],{#[[2]]}]&/@FactorInteger[ (n-1)!]], ?( MemberQ[Transpose[FactorInteger[n]][[1]],#]&)]; Array[cmpf,80] (* _Harvey P. Dale, Jan 23 2016 *)
  • PARI
    a(n) = {nm = (n-1)!; fn = factor(n); sum (i=1, #fn~, valuation(nm, fn[i,1]));} \\ Michel Marcus, Mar 15 2014
  • Sage
    m=100 # change n for more terms
    [sum(valuation(factorial(n-1),p) for p in prime_divisors(n) if p in prime_divisors(factorial(n-1))) for n in [2..m]] # Tom Edgar, Mar 14 2014
    

Formula

a(p) = 0 for p prime.
a(2n) > a(2n + 1) for all n > 2.

A145201 Triangle read by rows: T(n,k) = S(n,k) mod n, where S(n,k) = Stirling numbers of the first kind.

Original entry on oeis.org

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

Views

Author

Tilman Neumann, Oct 04 2008, Oct 06 2008

Keywords

Comments

The triangle T(n,k) contains many zeros. The distribution of nonzero entries is quite chaotic, but shows regular patterns, too, e.g.:
1) T(n,1) > 0 for n prime or n=4; T(n,1)=0 else
2) T(5k,k) > 0 for all k
More generally, it seems that:
3) T(pk,k) > 0 for k>0 and primes p
The following table depicts the zero (-) and nonzero (x) entries for the first 80 rows of the triangle:
-
xx
x-x
xxxx
x---x
-xxxxx
x-----x
-xxx-xxx
--x-x-x-x
-x--xx--xx
x---------x
---xxxxxxxxx
x-----------x
-x----xxxxxxxx
--x-x-x-x-x-x-x
-----xxx-x-x-xxx
x---------------x
-----x-xxx-x-x-xxx
x-----------------x
---x---xxxxx-x-xxxxx
--x---x-x---x-x---x-x
-x--------xxxx----xxxx
x---------------------x
-------x-xxx-xxx-xxx-xxx
----x---x---x---x---x---x
-x----------xx--xx--xx--xx
--------x-x-x-x-x-x-x-x-x-x
---x-----x--xxxxxxxxxxxxxxxx
x---------------------------x
-----x---x-x--xxxxxxxxxxxxxxxx
x-----------------------------x
-------------xxx-x-x-x-x-x-x-xxx
--x-------x-x-x-------x-----x-x-x
-x--------------xx--------------xx
----x-x---x---x-x-----x---x-x-x---x
-----------x-x-xxxxx---x-x-x-x-xxxxx
x-----------------------------------x
-x----------------xxxx------------xxxx
--x---------x-x---x-x-----x---x-x---x-x
-------x---x---x-xxx-xxx---x-x-x-xxx-xxx
x---------------------------------------x
-----x-----x-x-x-x-xxx-xxx---x-x-x-xxx-xxx
x-----------------------------------------x
---x---------x------xxxxxxxx-x-x-x-xxxxxxxxx
--------x---x-x-x-x-x-x-x-x-x---x-x-x-x-x-x-x
-x--------------------xxxxxxxx--------xxxxxxxx
x---------------------------------------------x
---------------x-x---xxx-x-x-xxx-x-x--xx-x-x-xxx
------x-----x-----x-----x-----x-----x-----x-----x
---------x---x---x---x--xx---x--xx---x--xx---x--xx
--x-------------x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x
---x-----------x--------xxxx-x-xxxxx---xxxxx-x-xxxxx
x---------------------------------------------------x
-----------------x-x-x-x-xxxxx-x-xxxxx-x-xxxxx-x-xxxxx
----x-----x---x---------x-----x---x---------x-----x---x
-------x-----x-----------xxx-xxx--xx-xxx-xxx-xxx-xxx-xxx
--x---------------x-x---------------x-x---------------x-x
-x--------------------------xx--xx--xx--xx--xx--xx--xx--xx
x---------------------------------------------------------x
-----------x---x---x-x-x----xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x-----------------------------------------------------------x
-x----------------------------xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--------x-----x-----x-x-x-x-----x-----x-x-x-x-----x-----x-x-x-x
-----------------------------xxx-x-x-x-x-x-x-x-x-x-x-x-x-x-x-xxx
----x-------x---x---x---x---x---x---x---x---x-------x---x---x---x
-----x---------x-----x-x-x-x-x--xx-x---x-x---x-x-------x-x-x---xxx
x-----------------------------------------------------------------x
---x---------------x------------xxxx-------------x-x------------xxxx
--x-------------------x-x-x-x-x-x-------x-x-x-x-x-x-------x-x-x-x-x-x
---------x---x-x-x---x---x-x-x---xxxxx---x---x---x-x-x---x---x-x-xxxxx
x---------------------------------------------------------------------x
-----------------------x-x-x-x-x-xxx-xxx-x-x-x-x-x-x-x-x---x-x-x-xxx-xxx
x-----------------------------------------------------------------------x
-x----------------------------------xx--xx--------------------------xx--xx
--------------x---x---x-x-x---x-x-x-x-x---x-x-x-x-x---x-x-x-x-x---x-x-x-x-x
---x-----------------x--------------xxxxxxxx---------x-x-x-x--------xxxxxxxx
------x---x-----x-----x---x-x-----x-x---------x-----x---x-x-----x-x---x-----x
-----x-----------x-------x-x-x-x-x-x-xxxxxxxxx-x-x-x-x-x-x-x-x-x-x-x-xxxxxxxxx
x-----------------------------------------------------------------------------x
---------------x---x---------------x-xxx-x-x-xxx---x---x-x-x-x-x---x-xxx-x-x-xxx
SUM(A057427(a(k)): 1<=k<=n) = A005127(n). - Reinhard Zumkeller, Jul 04 2009

Examples

			Triangle starts:
0;
1, 1;
2, 0, 1;
2, 3, 2, 1;
4, 0, 0, 0, 1;
0, 4, 3, 1, 3, 1;
6, 0, 0, 0, 0, 0, 1;
....
		

Crossrefs

Cf. A000040, A008275, A061006 (first column).

Programs

  • PARI
    tabl(nn) = {for (n=1, nn, for (k=1, n, print1(stirling(n, k, 1) % n, ", ");); print(););} \\ Michel Marcus, Aug 10 2015

Formula

T(n,k) = S(n,k) mod n, where S(n,k) = Stirling numbers of the first kind.

A166260 a(n) = A089026(n) - 1.

Original entry on oeis.org

0, 1, 2, 0, 4, 0, 6, 0, 0, 0, 10, 0, 12, 0, 0, 0, 16, 0, 18, 0, 0, 0, 22, 0, 0, 0, 0, 0, 28, 0, 30, 0, 0, 0, 0, 0, 36, 0, 0, 0, 40, 0, 42, 0, 0, 0, 46, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 58, 0, 60, 0, 0, 0, 0, 0, 66, 0, 0, 0, 70, 0, 72, 0, 0, 0, 0, 0, 78, 0, 0, 0, 82, 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Mats Granvik, Oct 10 2009

Keywords

Comments

Same as A061006 except for a(4) = 0 (Wilson's Theorem). - Georg Fischer, Oct 12 2018

Crossrefs

Cf. A119690. - R. J. Mathar, Oct 16 2009

Programs

  • PARI
    a(n) = if (isprime(n), n-1, 0); \\ Michel Marcus, Oct 12 2018

Formula

a(n) = (n-1) * A010051(n). - Wesley Ivan Hurt, Oct 12 2018

A175624 a(n) = n! modulo n*(n+1)*(n+2)/3.

Original entry on oeis.org

1, 2, 6, 24, 50, 48, 0, 0, 210, 120, 352, 168, 0, 0, 800, 288, 1122, 360, 0, 0, 2002, 528, 0, 0, 0, 0, 4032, 840, 4930, 960, 0, 0, 0, 0, 8400, 1368, 0, 0, 11440, 1680, 13202, 1848, 0, 0, 17250, 2208, 0, 0, 0, 0, 24752, 2808, 0, 0, 0, 0, 34162, 3480, 37760, 3720, 0, 0, 0, 0
Offset: 1

Views

Author

John W. Layman, Jul 27 2010

Keywords

Comments

It appears that a(1)=1, a(2)=2, a(3)=6, and, for n>3, a(n) = n*(n+2) if n+1 is prime, else a(n) = n*(n+1)*(n+5)/6 if n+2 is prime, else a(n)=0. This has been verified for n up to 1000.

Crossrefs

Programs

  • Magma
    [Factorial(n) mod (2*Binomial(n+2,3)): n in [1..80]]; // G. C. Greubel, Apr 12 2024
    
  • Mathematica
    Table[Mod[(n!), (n^3 + 3 n^2 + 2 n)/3], {n, 100}] (* Vincenzo Librandi, Jul 10 2014 *)
  • PARI
    a(n) = n! % (n*(n+1)*(n+2)/3); \\ Michel Marcus, Jul 09 2014
    
  • SageMath
    [factorial(n)%(2*binomial(n+2,3)) for n in range(1,81)] # G. C. Greubel, Apr 12 2024

A285982 a(n) = n! (mod n + 3).

Original entry on oeis.org

1, 1, 2, 0, 3, 0, 0, 0, 5, 0, 6, 0, 0, 0, 8, 0, 9, 0, 0, 0, 11, 0, 0, 0, 0, 0, 14, 0, 15, 0, 0, 0, 0, 0, 18, 0, 0, 0, 20, 0, 21, 0, 0, 0, 23, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 29, 0, 30, 0, 0, 0, 0, 0, 33, 0, 0, 0, 35, 0, 36, 0, 0, 0, 0, 0, 39, 0, 0, 0, 41, 0, 0
Offset: 0

Views

Author

Seiichi Manyama, Apr 29 2017

Keywords

Comments

Nonzero terms are a(2 * A130290(n) - 2) = A130290(n) for n > 1. - David A. Corneth, Apr 30 2017

Crossrefs

Programs

Formula

a(n) = A000142(n) (mod n + 3).
If n > 1 and a(n) > 0, a(n) = n/2 + 1 and n + 3 is a prime.

A180589 a(n) = floor(n!*h(n)/n), where h(n) = Sum_{k=1..n} 1/k.

Original entry on oeis.org

1, 1, 3, 12, 54, 294, 1866, 13698, 114064, 1062864, 10958530, 123870240, 1523289156, 20247546240, 289277533440, 4420892649600, 71965034739952, 1243166003251200, 22713955095665178, 437647401838080000, 8868800513341440000, 188567126333429760000, 4197346376195350706086
Offset: 1

Views

Author

Gary Detlefs, Sep 10 2010

Keywords

Crossrefs

Programs

  • Maple
    h:= n->sum(1/k,k=1..n):seq(floor(n!*h(n)/n),n=1..25);
  • Mathematica
    a[n_]:=Floor[n!*Sum[1/k,{k,n}]/n]; Array[a,23] (* Stefano Spezia, Apr 20 2025 *)

Formula

a(n) = (A000254(n) - A061006(n))/n.

Extensions

a(21)-a(23) from Stefano Spezia, Apr 20 2025
Showing 1-10 of 10 results.