OFFSET
1,2
COMMENTS
Inspired by the following triangle for the initial terms:
1! = 1.
1! + 3! = 7.
1! + 3! + 5! = 127.
1! + 3! + 5! + 7! = 5167.
1! + 3! + 5! + 7! + 9! = 368047.
This sequence is finite since 107 divides A138523(n) for all n >= 53. - Amiram Eldar, Apr 20 2017
EXAMPLE
a(4) = 4 because 1! + 3! + 5! + 7! = 5167 is prime.
MATHEMATICA
Select[Range@ 1000, Or[# == 1, PrimeQ@ #] &@ Sum[(2 k - 1)!, {k, #}] &] (* Michael De Vlieger, Dec 01 2015 *)
PROG
(PARI) lista(nn) = { print1(1, ", "); s = 0; for(k=1, nn, s += (2*k-1)!; if(ispseudoprime(s), print1(k, ", ")); ); }
CROSSREFS
KEYWORD
nonn,fini,full
AUTHOR
Altug Alkan, Dec 01 2015
STATUS
approved