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.

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.

This page as a plain text file.
%I A102863 #13 Jun 16 2020 18:17:08
%S A102863 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,
%T A102863 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,
%U A102863 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
%N 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.
%C A102863 a(n) = 0 if and only if n is in A013916. - _Robert Israel_, Jan 04 2017
%H A102863 Robert Israel, <a href="/A102863/b102863.txt">Table of n, a(n) for n = 1..10000</a>
%e A102863 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.
%p A102863 with(numtheory):
%p A102863 a:=proc(n)
%p A102863    if nops(factorset(sum(ithprime(k),k=1..n)) intersect {seq(ithprime(j),j=1..n)}) >0 then
%p A102863       1
%p A102863    else
%p A102863       0
%p A102863    fi
%p A102863 end:
%p A102863 seq(a(n),n=1..130); # _Emeric Deutsch_
%p A102863 # alternative:
%p A102863 N:= 500: # to get the first N terms
%p A102863 A:= Vector(N):
%p A102863 S:= 2: P:= 2: p:= 2: A[1]:= 1:
%p A102863 for n from 2 to N do
%p A102863   p:= nextprime(p);
%p A102863   S:= S+p; P:= P*p;
%p A102863   if igcd(S,P) > 1 then A[n]:= 1 fi
%p A102863 od:
%p A102863 convert(A,list); # _Robert Israel_, Jan 04 2017
%t A102863 a[n_] := Module[{pp = Prime[Range[n]], t}, t = Total[pp]; Boole[AnyTrue[pp, Divisible[t, #]&]]];
%t A102863 Array[a, 100] (* _Jean-François Alcover_, Jun 16 2020 *)
%Y A102863 A105783(n) gives number of primes among the first n primes that are divisors of the sum of the first n primes.
%Y A102863 Cf. A013916, A136443.
%K A102863 easy,nonn
%O A102863 1,1
%A A102863 _Giovanni Teofilatto_, Mar 01 2005
%E A102863 Edited and extended by _Emeric Deutsch_, Apr 19 2005