login
A225841
Numbers n such that the sum of first n primorial numbers is divisible by n.
0
1, 2, 4, 523, 1046, 2092
OFFSET
1,2
COMMENTS
The k-th primorial number is defined as the product of the first k primes.
The next term, if it exists, is greater than 14000000. - Alex Ratushnyak, Jun 13 2013
If a prime p | a(n) for some n, then p = 2, p = 523, or p > 10^8. Any such prime is itself a member of this sequence. From this (and a small amount of additional calculation) it follows that any other terms below 10^10 are of the form 2^k * p for p > 10^8. - Charles R Greathouse IV, Feb 09 2014
EXAMPLE
2 + 2*3 + 2*3*5 + 2*3*5*7 = 2 + 6 + 30 + 210 = 248, because 248 is divisible by 4, the latter is in the sequence.
MATHEMATICA
With[{nn=2100}, Select[Thread[{Accumulate[FoldList[Times, Prime[ Range[ nn]]]], Range[nn]}], Divisible[ #[[1]], #[[2]]]&]][[All, 2]] (* Harvey P. Dale, Jul 29 2021 *)
PROG
(Python)
primes = []
n = 1
sum = 2
primorial = 6
def addPrime(k):
global n, sum, primorial
for p in primes:
if k%p==0: return
if p*p > k: break
primes.append(k)
sum += primorial
primorial *= k
n += 1
if sum % n == 0: print(n, end=', ')
print(1, end=', ')
for p in range(5, 100000, 6):
addPrime(p)
addPrime(p+2)
(PARI) list(maxx)={n=prime(1); cnt=1; summ=0; scnt=0;
while(n<=maxx, summ=summ+prodeuler(x=1, prime(cnt), x);
if(summ%cnt==0, scnt++; print(scnt, " ", cnt) ); cnt++; n=nextprime(n+1) ); }
\\note MUST increase precision to 10000+ digits \\Bill McEachen, Feb 04 2014
(PARI) P=1; S=n=0; forprime(p=2, 1e4, S+=P*=p; if(S%n++==0, print1(n", "))) \\ Charles R Greathouse IV, Feb 05 2014
(PARI) is(n)=my(q=prime(n), P=Mod(1, n), S); forprime(p=2, q, S+=P*=p); !S \\ Charles R Greathouse IV, Feb 05 2014
(Python)
from itertools import accumulate, count, islice
from operator import mul
from sympy import prime
def A225841_gen(): return (i+1 for i, m in enumerate(accumulate(accumulate((prime(n) for n in count(1)), mul))) if m % (i+1) == 0)
A225841_list = list(islice(A225841_gen(), 6)) # Chai Wah Wu, Feb 23 2022
CROSSREFS
KEYWORD
nonn,hard,more
AUTHOR
Alex Ratushnyak, May 21 2013
STATUS
approved