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.

A075557 a(n) is the smallest odd prime such that (1) a(n) doesn't already appear in the sequence; (2) the n-th partial sum is divisible by n; and (3) the n-th partial sum is relatively prime to n+1.

This page as a plain text file.
%I A075557 #14 Dec 08 2024 04:00:55
%S A075557 3,5,7,13,37,31,23,17,53,11,251,29,79,43,73,61,97,67,107,173,59,103,
%T A075557 199,163,71,149,47,101,509,89,151,283,229,271,211,109,257,113,269,157,
%U A075557 241,331,83,389,41,313,1543,19,307,463,373,277,811,457,137,191,419,311,197
%N A075557 a(n) is the smallest odd prime such that (1) a(n) doesn't already appear in the sequence; (2) the n-th partial sum is divisible by n; and (3) the n-th partial sum is relatively prime to n+1.
%C A075557 Condition (3) is needed to ensure that a(n+1) exists.
%H A075557 Robert Israel, <a href="/A075557/b075557.txt">Table of n, a(n) for n = 1..10000</a>
%e A075557 a(5)=37: The 4th partial sum is 28. 7 is the smallest odd prime that satisfies (2) (28+7=35), but 7 has already been used. 17 satisfies (1) and (2) (28+17=45), but 45+a(6) must be a multiple of 6 and the only odd prime satisfying that requirement is 3, which has already been used. 37 works (28+37=65).
%p A075557 N:= 10000: # for terms until the first term > N.
%p A075557 Cands:= select(isprime, [seq(i,i=3..N,2)]):
%p A075557 nC:= nops(Cands):
%p A075557 R:= NULL: s:= 0:
%p A075557 for n from 1 do
%p A075557   found:= false;
%p A075557   for i from 1 to nC do
%p A075557     if s + Cands[i] mod n = 0 and igcd(s + Cands[i],n+1) = 1 then
%p A075557        R:= R, Cands[i];
%p A075557        s:= s + Cands[i];
%p A075557        Cands:= subsop(i=NULL,Cands);
%p A075557        nC:= nC-1;
%p A075557        found:= true;
%p A075557        break
%p A075557      fi
%p A075557   od;
%p A075557   if not found then break fi
%p A075557 od:
%p A075557 R; # _Robert Israel_, Dec 07 2024
%Y A075557 Cf. A065091 (odd primes).
%K A075557 nonn,easy,look
%O A075557 1,1
%A A075557 _Amarnath Murthy_, Sep 24 2002
%E A075557 Edited by _David Wasserman_, Jun 27 2003
%E A075557 Corrected by _Robert Israel_, Dec 07 2024