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.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

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

Views

Author

Giovanni Teofilatto, Mar 01 2005

Keywords

Comments

a(n) = 0 if and only if n is in A013916. - Robert Israel, Jan 04 2017

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.
		

Crossrefs

A105783(n) gives number of primes among the first n primes that are divisors of the sum of the first n primes.

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

A302567 a(n) is the number of primes less than the n-th prime that divide the sum of primes up to the n-th prime.

Original entry on oeis.org

0, 0, 1, 0, 2, 0, 1, 2, 2, 1, 2, 0, 3, 0, 2, 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 2, 2, 1, 3, 2, 3, 1, 3, 1, 1, 1, 3, 2, 3, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 3, 3, 2, 4, 1, 1, 3, 4, 2, 1, 0, 2, 1, 2, 0, 1, 2, 2, 3, 2, 3, 3, 1, 3, 1, 1, 2, 4, 1, 3, 3, 1, 1, 1, 4, 3, 2, 4, 3, 3, 3, 4, 1, 1, 2, 1, 0, 2, 3, 2, 0, 2, 0, 4, 1, 4
Offset: 1

Views

Author

G. L. Honaker, Jr., Apr 11 2018

Keywords

Comments

This sequence differs from A105783 only at n = 1, 3, 20, 31464, 22096548, ... (the terms of A024011); see Example section. - Jon E. Schoenfield, Apr 11 2018

Examples

			a(13)=3 because the 13th prime is 41 and the sum of primes up to 41 is 238, which has 3 distinct prime factors less than 41.
a(20)=1 because the 20th prime is 71 and the sum of primes up to 71 is 639 = 7*71, which has only 1 distinct prime factor less than 71. - _Jon E. Schoenfield_, Apr 11 2018
		

Crossrefs

Programs

  • Maple
    s:= proc(n) option remember; `if`(n<1, 0, ithprime(n)+s(n-1)) end:
    a:= n-> nops(select(x-> x < ithprime(n), numtheory[factorset](s(n)))):
    seq(a(n), n=1..100);  # Alois P. Heinz, Apr 11 2018
  • Mathematica
    a[n_] := (S = Total[P = Prime[Range[n]]]; Count[P, p_ /; Divisible[S, p]]);
    Array[a, 100] (* Jean-François Alcover, Apr 30 2019 *)
  • PARI
    a(n) = #select(x->(x < prime(n)), factor(sum(k=1, n, prime(k)))[,1]); \\ Michel Marcus, Apr 11 2018

Formula

a(n) = A105783(n) - 1 if n is in A024011; otherwise, a(n) = A105783(n). - Jon E. Schoenfield, Apr 11 2018
Showing 1-2 of 2 results.