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 A055265 #115 Mar 30 2020 18:37:43 %S A055265 1,2,3,4,7,6,5,8,9,10,13,16,15,14,17,12,11,18,19,22,21,20,23,24,29,30, %T A055265 31,28,25,34,27,26,33,38,35,32,39,40,43,36,37,42,41,48,49,52,45,44,53, %U A055265 50,47,54,55,46,51,56,57,70,61,66,65,62,69,58,73,64,63,68,59,72,67,60 %N A055265 a(n) is the smallest positive integer not already in the sequence such that a(n)+a(n-1) is prime, starting with a(1)=1. %C A055265 The sequence is well-defined (the terms must alternate in parity, and by Dirichlet's theorem a(n+1) always exists). - _N. J. A. Sloane_, Mar 07 2017 %C A055265 Does every positive integer eventually occur? - _Dmitry Kamenetsky_, May 27 2009. Reply from _Robert G. Wilson v_, May 27 2009: The answer is almost certainly yes, on probabilistic grounds. %C A055265 It appears that this is the limit of the rows of A051237. That those rows do approach a limit seems certain, and given that that limit exists, that this sequence is the limit seems even more likely, but no proof is known for either conjecture. - _Robert G. Wilson v_, Mar 11 2011, edited by _Franklin T. Adams-Watters_, Mar 17 2011 %C A055265 The sequence is also a particular case of "among the pairwise sums of any M consecutive terms, N are prime", with M = 2, N = 1. For other M, N see A055266 & A253074 (M = 2, N = 0), A329333, A329405 - A329416, A329449 - A329456, A329563 - A329581, and the OEIS Wiki page. - _M. F. Hasler_, Feb 11 2020 %H A055265 Zak Seidov, <a href="/A055265/b055265.txt">Table of n, a(n) for n = 1..10000</a> (First 1000 terms from T. D. Noe) %H A055265 N. J. A. Sloane, <a href="/A055265/a055265.txt">Table of n, a(n) for n = 1..100000</a> (computed using Orlovsky's Mma program) %H A055265 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 %H A055265 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A055265 a(2n-1) = A128280(2n-1) - 1, a(2n) = A128280(2n) + 1, for all n >= 1. - _M. F. Hasler_, Feb 11 2020 %e A055265 a(5) = 7 because 1, 2, 3 and 4 have already been used and neither 4 + 5 = 9 nor 4 + 6 = 10 are prime while 4 + 7 = 11 is prime. %p A055265 A055265 := proc(n) %p A055265 local a,i,known ; %p A055265 option remember; %p A055265 if n =1 then %p A055265 1; %p A055265 else %p A055265 for a from 1 do %p A055265 known := false; %p A055265 for i from 1 to n-1 do %p A055265 if procname(i) = a then %p A055265 known := true; %p A055265 break; %p A055265 end if; %p A055265 end do: %p A055265 if not known and isprime(procname(n-1)+a) then %p A055265 return a; %p A055265 end if; %p A055265 end do: %p A055265 end if; %p A055265 end proc: %p A055265 seq(A055265(n),n=1..100) ; # _R. J. Mathar_, Feb 25 2017 %t A055265 f[s_List] := Block[{k = 1, a = s[[ -1]]}, While[ MemberQ[s, k] || ! PrimeQ[a + k], k++ ]; Append[s, k]]; Nest[f, {1}, 71] (* _Robert G. Wilson v_, May 27 2009 *) %t A055265 q=2000; a={1}; z=Range[2,2*q]; While[Length[z]>q-1, k=1; While[!PrimeQ[z[[k]]+Last[a]], k++]; AppendTo[a,z[[k]]]; z=Delete[z,k]]; Print[a] (*200 times faster*) (* _Vladimir Joseph Stephan Orlovsky_, May 03 2011 *) %o A055265 (HP 50G Calculator) << DUPDUP + 2 -> N M L << { 1 } 1 N 1 - FOR i L M FOR j DUP j POS NOT IF THEN j DUP 'L' STO M 'j' STO END NEXT OVER i GET SWAP WHILE DUP2 + DUP ISPRIME? NOT REPEAT DROP DO 1 + 3 PICK OVER POS NOT UNTIL END END ROT DROP2 + NEXT >> >> _Gerald Hillier_, Oct 28 2008 %o A055265 (Haskell) %o A055265 import Data.List (delete) %o A055265 a055265 n = a055265_list !! (n-1) %o A055265 a055265_list = 1 : f 1 [2..] where %o A055265 f x vs = g vs where %o A055265 g (w:ws) = if a010051 (x + w) == 1 %o A055265 then w : f w (delete w vs) else g ws %o A055265 -- _Reinhard Zumkeller_, Feb 14 2013 %o A055265 (PARI) v=[1];n=1;while(n<50,if(isprime(v[#v]+n)&&!vecsearch(vecsort(v),n), v=concat(v,n);n=0);n++);v \\ _Derek Orr_, Jun 01 2015 %o A055265 (PARI) U=-a=1; vector(100,k, k=valuation(1+U+=1<<a, 2); while(bittest(U,k)|| !isprime(a+k), k++); a=k) \\ _M. F. Hasler_, Feb 11 2020 %Y A055265 Inverse permutation: A117922; fixed points: A117925; A117923=a(a(n)). - _Reinhard Zumkeller_, Apr 03 2006 %Y A055265 Cf. A036440, A051237, A051239, A055266, A088643. A010051. %Y A055265 Cf. A086527 (the primes a(n)+a(n-1)). %Y A055265 Cf. A070942 (n's such that a(1..n) is a permutation of (1..n)). - _Zak Seidov_, Oct 19 2011 %Y A055265 See also A076990, A243625. %Y A055265 See A282695 for deviation from identity sequence. %Y A055265 A073659 is a version where the partial sums must be primes. %K A055265 easy,nice,nonn %O A055265 1,2 %A A055265 _Henry Bottomley_, May 09 2000 %E A055265 Corrected by _Hans Havermann_, Sep 24 2002