OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
FORMULA
EXAMPLE
Sum of first 8 primes is 77 and product of first 8 primes is 9699690. 77 divides 9699690 therefore a(3)=8.
MATHEMATICA
p = Prime@ Range@ 250; Flatten@ Position[ Mod[ First@#, Last@#] & /@ Partition[ Riffle[ Rest[ FoldList[ Times, 1, p]], Accumulate@ p], 2], 0] (* Harvey P. Dale, Dec 19 2010 *)
PROG
(Haskell)
import Data.List (elemIndices)
a051838 n = a051838_list !! (n-1)
a051838_list =
map (+ 1) $ elemIndices 0 $ zipWith mod a002110_list a007504_list
-- Reinhard Zumkeller, Oct 03 2011
(PARI) for(n=1, 100, P=prod(i=1, n, prime(i)); S=sum(i=1, n, prime(i)); if(!(P%S), print1(n, ", "))) \\ Derek Orr, Jul 19 2015
(PARI) isok(n) = my(p = primes(n)); (vecprod(p) % vecsum(p)) == 0; \\ Michel Marcus, Dec 20 2018
(GAP) P:=Filtered([1..2000], IsPrime);;
Filtered([1..Length(P)], n->Product([1..n], i->P[i]) mod Sum([1..n], i->P[i])=0); # Muniru A Asiru, Dec 20 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
G. L. Honaker, Jr., Dec 12 1999
STATUS
approved