login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A051838 Numbers n such that sum of first n primes divides product of first n primes. 18

%I

%S 1,3,8,13,23,38,39,41,43,48,50,53,56,57,58,66,68,70,73,77,84,90,94,98,

%T 126,128,134,140,143,145,149,151,153,157,160,164,167,168,172,174,176,

%U 182,191,194,196,200,210,212,215,217,218,219,222,225,228,229

%N Numbers n such that sum of first n primes divides product of first n primes.

%C A002110(a(n)) mod A007504(a(n)) = 0, A116536(n) = A002110(a(n)) / A007504(a(n)). [_Reinhard Zumkeller_, Oct 03 2011]

%H T. D. Noe, <a href="/A051838/b051838.txt">Table of n, a(n) for n = 1..1000</a>

%e Sum of first 8 primes is 77 and product of first 8 primes is 9699690. 77 divides 9699690 therefore a(3)=8.

%p P:=proc(q) local i,m,n,p,s; m:=1; s:=0; n:=[]; for i from 1 to q do

%p p:=ithprime(i); m:=m*p; s:=s+p; if frac(m/s)=0 then n:=[op(n),i]; fi;

%p od; op(n); end: P(230); # _Paolo P. Lava_, Dec 20 2018

%t 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 *)

%o (Haskell)

%o import Data.List (elemIndices)

%o a051838 n = a051838_list !! (n-1)

%o a051838_list =

%o map (+ 1) $ elemIndices 0 $ zipWith mod a002110_list a007504_list

%o -- _Reinhard Zumkeller_, Oct 03 2011

%o (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

%o (PARI) isok(n) = my(p = primes(n)); (vecprod(p) % vecsum(p)) == 0; \\ _Michel Marcus_, Dec 20 2018

%o (GAP) P:=Filtered([1..2000],IsPrime);;

%o 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

%Y Cf. A007504, A002110. A116536 gives the quotients, A140763 the divisors and A159578 the dividends. See also A159639.

%Y Cf. A196415.

%K nonn

%O 1,2

%A _G. L. Honaker, Jr._, Dec 12 1999

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 26 00:45 EDT 2019. Contains 321479 sequences. (Running on oeis4.)