A102863 a(n)=1 if at least one of the first n primes is a divisor of the sum of the first n primes; otherwise a(n)=0.
1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1
Offset: 1
Examples
a(2)=0 because none of the first 2 primes (2, 3) is a divisor of 2+3; a(5)=1 because among the first 5 primes (namely, 2,3,5,7,11) there are divisors of 2+3+5+7+11=28.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Maple
with(numtheory): a:=proc(n) if nops(factorset(sum(ithprime(k),k=1..n)) intersect {seq(ithprime(j),j=1..n)}) >0 then 1 else 0 fi end: seq(a(n),n=1..130); # Emeric Deutsch # alternative: N:= 500: # to get the first N terms A:= Vector(N): S:= 2: P:= 2: p:= 2: A[1]:= 1: for n from 2 to N do p:= nextprime(p); S:= S+p; P:= P*p; if igcd(S,P) > 1 then A[n]:= 1 fi od: convert(A,list); # Robert Israel, Jan 04 2017
-
Mathematica
a[n_] := Module[{pp = Prime[Range[n]], t}, t = Total[pp]; Boole[AnyTrue[pp, Divisible[t, #]&]]]; Array[a, 100] (* Jean-François Alcover, Jun 16 2020 *)
Extensions
Edited and extended by Emeric Deutsch, Apr 19 2005
Comments