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.

A175940 Number of ways of writing n=p+f with p a prime and f a factorial.

This page as a plain text file.
%I A175940 #16 Feb 02 2023 09:59:20
%S A175940 0,0,1,2,1,1,1,2,2,0,1,1,2,1,1,0,1,1,2,1,1,0,1,1,2,1,1,0,2,1,2,1,1,0,
%T A175940 2,0,2,1,1,0,1,1,3,1,1,0,2,1,2,0,0,0,2,1,2,0,0,0,1,1,2,1,1,0,2,0,2,1,
%U A175940 1,0,1,1,2,1,1,0,2,0,1,1,1,0,1,1,3,0,0,0,1,1,2,0,0,0,2,0,1,1,1,0,0,1,3,1,1
%N A175940 Number of ways of writing n=p+f with p a prime and f a factorial.
%C A175940 Number of partitions of n into the sum of a prime number and a factorial number. Number of decompositions of n into an unordered sum of a prime number and a factorial number.
%H A175940 Robert Israel, <a href="/A175940/b175940.txt">Table of n, a(n) for n = 1..10000</a>
%e A175940 a(29)=2 because 29 has two prime + factorial representations, 5+4! and 23+3!.
%p A175940 a:= proc(n) local t,k;
%p A175940        t:= 0;
%p A175940        for k while k! < n do
%p A175940          if isprime(n-k!) then t:= t+1 fi
%p A175940        od;
%p A175940        t
%p A175940 end proc:
%p A175940 seq(a(n), n=1..100); # _Robert Israel_, Oct 13 2014
%t A175940 a[n_] := Module[{t = 0, k}, For[k = 1, k! < n, k++, If[PrimeQ[n - k!] , t++]]; t];
%t A175940 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Feb 02 2023, after _Robert Israel_ *)
%o A175940 (PARI)
%o A175940 a(n) = c=0;for(i=1,n,if(isprime(n-i!),c++));c
%o A175940 vector(100,n,a(n)) \\ _Derek Orr_, Oct 13 2014
%Y A175940 Cf. A000142, A062602, A175931, A175933.
%K A175940 nonn
%O A175940 1,4
%A A175940 _Juri-Stepan Gerasimov_, Oct 25 2010
%E A175940 Edited and entries checked by _D. S. McNeil_, Nov 26 2010