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.
%I A329333 #87 Dec 21 2024 11:49:43 %S A329333 0,1,2,7,3,6,4,5,8,10,11,9,12,14,15,13,18,17,19,20,21,24,16,23,25,22, %T A329333 26,27,28,31,29,32,33,34,30,39,37,36,38,41,40,42,43,46,35,44,47,45,50, %U A329333 51,48,49,56,52,53,54,57,55,58,59,68,60,63,64,61,66,62,69,67,72,71,65,74,70,75,76,77 %N A329333 There is exactly one odd prime among the pairwise sums of any three consecutive terms: Lexicographically earliest sequence of distinct nonnegative integers with this property. %C A329333 This is conjectured and designed to be a permutation of the nonnegative integers, therefore the offset is taken to be zero. %C A329333 Restricted to positive indices, this is a sequence of positive integers having the same property, then conjectured to be a permutation of the positive integers. (The word "odd" can be omitted in this case.) %C A329333 If the word "odd" is dropped from the original definition, the sequence starts (0, 1, 3, 6, 2, 7), and then continues from a(6) = 4 onward as the present sequence. This is again conjectured to be a permutation of the nonnegative integers, and a permutation of the positive integers when restricted to the domain [1..oo). The latter however no longer has the property of lexicographic minimality. %C A329333 See the OEIS wiki page for further considerations about existence, surjectivity and variants. - _M. F. Hasler_, Nov 24 2019 %H A329333 Jean-Marc Falcoz, <a href="/A329333/b329333.txt">Table of n, a(n) for n = 0..20000</a>. %H A329333 Eric Angelini, <a href="http://cinquantesignes.blogspot.com/2019/11/prime-sums-from-neighbouring-terms.html">Prime sums from neighbouring terms</a>, personal blog "Cinquante signes" (and post to the SeqFan list), Nov. 11, 2019. %H A329333 Eric Angelini, <a href="/A329333/a329333.htm">Prime sums from neighbouring terms</a> [Cached copy of html file, with permission] %H A329333 Eric Angelini, <a href="/A329333/a329333.pdf">Prime sums from neighbouring terms</a> [Cached copy of pdf file, with permission] %H A329333 M. F. Hasler, <a href="/wiki/User:M._F._Hasler/Prime_sums_from_neighboring_terms">Prime sums from neighboring terms</a>, OEIS wiki, Nov. 23, 2019 %e A329333 For the first two terms there is no restriction regarding primality, so a(0) = 0, a(1) = 1. (If only positive values and indices are considered, then a(1) = 1 and a(2) = 2.) %e A329333 Then a(2) must be such that among { 0+1, 0+a(2), 1+a(2) } there is exactly one odd prime, and 2 works. %e A329333 Then a(3) must be such that among { 1+2, 1+a(3), 2+a(3) } there is only one (odd) prime. Since 1+2 = 3, the other two sums must both yield a composite. This excludes 3, 4, 5 and 6 and the smallest possibility is a(3) = 7. %e A329333 And so on. %t A329333 a[0]=0;a[1]=1;a[2]=2;a[n_]:=a[n]=(k=1;While[Length@Select[Plus@@@Subsets[{a[n-1],a[n-2],++k},{2}],PrimeQ]!=1||MemberQ[Array[a,n-1,0],k]];k);Array[a,100,0] (* _Giorgos Kalogeropoulos_, May 07 2021 *) %o A329333 (PARI) A329333(n,show=0,o=0,p=0,U=[])={for(n=o,n-1, show&&print1(o","); U=setunion(U,[o]); while(#U>1&&U[1]==U[2]-1,U=U[^1]); for(k=U[1]+1,oo, setsearch(U,k)|| if(isprime(o+p), isprime(o+k)|| isprime(p+k), isprime(o+k)==isprime(p+k)&&p)||[o&&p=o, o=k, break]));o} \\ Optional args: show = 1: print all values up to a(n); o = 1: start with a(1) = 1; p = 1: compute the variant with a(2) = 3. See the wiki page for more general code which returns the whole vector: Use S(n_max,1,3,1) or S(n_max,1,3,2,[0,1]); S(n_max,1,3,0) gives the variant (0, 1, 3, ...) %Y A329333 For the primes that arise, or are missing, see A328997, A328998. %Y A329333 See A329450 for the variant having 0 primes among a(n+i) + a(n+j), 0 <= i < j < 3. %Y A329333 See A329452 for the variant having 2 primes among a(n+i) + a(n+j), 0 <= i < j < 4. %Y A329333 A084937, A305369 have comparable conditions on three consecutive terms. %Y A329333 Cf. A025044, A128280. %K A329333 nonn %O A329333 0,3 %A A329333 _Eric Angelini_, _Jean-Marc Falcoz_ and _M. F. Hasler_, Nov 12 2019 %E A329333 Entry revised by _N. J. A. Sloane_, Nov 14 2019 and _M. F. Hasler_, Nov 15 2019