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.

A239942 a(n) = prime(n)! - prime(n - 1)!.

This page as a plain text file.
%I A239942 #23 Feb 22 2025 16:11:41
%S A239942 4,114,4920,39911760,6187104000,355681201075200,121289412980736000,
%T A239942 25851895093784567808000,8841761967887685215658639360000,
%U A239942 8213996892184183115771019264000000,13763753083003506392138056763855339520000000
%N A239942 a(n) = prime(n)! - prime(n - 1)!.
%H A239942 Michael De Vlieger, <a href="/A239942/b239942.txt">Table of n, a(n) for n = 2..87</a>
%F A239942 a(n) = A039716(n) - A039716(n-1).
%e A239942 a(3) = Prime(3)! - Prime(2)! = 5! - 3! = 120 - 6 = 114.
%p A239942 A239942:=n->ithprime(n)!-ithprime(n-1)!: seq(A239942(n), n=2..15); # _Wesley Ivan Hurt_, Aug 03 2014
%t A239942 a239942[n_Integer] := Prime[n]! - Prime[n - 1]!; Table[a239942[n], {n, 2, 87}] (* _Michael De Vlieger_, Aug 03 2014 *)
%o A239942 (Perl)
%o A239942 #!/usr/bin/perl
%o A239942 use strict;
%o A239942 use warnings;
%o A239942 use feature 'say';
%o A239942 use Math::Prime::XS qw(is_prime);
%o A239942 use Memoize;
%o A239942 use Math::BigInt;
%o A239942 memoize('factorial');
%o A239942 use Data::Dumper;
%o A239942 my @primes = ();
%o A239942 for (2 .. 200) {
%o A239942         if(is_prime($_)) {
%o A239942                 push @primes, $_;
%o A239942         }
%o A239942 }
%o A239942 for (1 .. $#primes) {
%o A239942         say factorial($primes[$_]) - factorial($primes[$_ - 1]);
%o A239942 }
%o A239942 sub factorial {
%o A239942         my $x = Math::BigInt->new(shift);
%o A239942         return $x if $x == 1;
%o A239942         return factorial($x - 1) * $x;
%o A239942 }
%o A239942 (PARI)  a(n)=prime(n)! - prime(n-1)!;
%o A239942 vector(22,n,a(n+1)) \\ _Joerg Arndt_, Mar 31 2014
%o A239942 (Python)
%o A239942 from gmpy2 import mpz,fac
%o A239942 from sympy import prime
%o A239942 def A239942(n):
%o A239942     return fac(mpz(prime(n))) - fac(mpz(prime(n-1))) # _Chai Wah Wu_, Aug 06 2014
%Y A239942 Cf. A000040, A039716.
%K A239942 nonn
%O A239942 2,1
%A A239942 _Norman Koch_, Mar 29 2014