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.

A051838 Numbers k such that sum of first k primes divides product of first k primes.

This page as a plain text file.
%I A051838 #59 Feb 13 2024 06:58:42
%S A051838 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 A051838 126,128,134,140,143,145,149,151,153,157,160,164,167,168,172,174,176,
%U A051838 182,191,194,196,200,210,212,215,217,218,219,222,225,228,229
%N A051838 Numbers k such that sum of first k primes divides product of first k primes.
%H A051838 Amiram Eldar, <a href="/A051838/b051838.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from T. D. Noe)
%F A051838 From _Reinhard Zumkeller_, Oct 03 2011: (Start)
%F A051838 A002110(a(n)) mod A007504(a(n)) = 0.
%F A051838 A116536(n) = A002110(a(n)) / A007504(a(n)). (End)
%e A051838 Sum of first 8 primes is 77 and product of first 8 primes is 9699690. 77 divides 9699690 therefore a(3)=8.
%t A051838 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 A051838 (Haskell)
%o A051838 import Data.List (elemIndices)
%o A051838 a051838 n = a051838_list !! (n-1)
%o A051838 a051838_list =
%o A051838    map (+ 1) $ elemIndices 0 $ zipWith mod a002110_list a007504_list
%o A051838 -- _Reinhard Zumkeller_, Oct 03 2011
%o A051838 (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 A051838 (PARI) isok(n) = my(p = primes(n)); (vecprod(p) % vecsum(p)) == 0; \\ _Michel Marcus_, Dec 20 2018
%o A051838 (GAP) P:=Filtered([1..2000],IsPrime);;
%o A051838 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 A051838 Cf. A007504, A002110, A159639, A196415.
%Y A051838 A116536 gives the quotients, A140763 the divisors and A159578 the dividends.
%K A051838 nonn
%O A051838 1,2
%A A051838 _G. L. Honaker, Jr._, Dec 12 1999