login
This site is supported by donations to The OEIS Foundation.

 

Logo

"Email this user" was broken Aug 14 to 9am Aug 16. If you sent someone a message in this period, please send it again.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 23
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, 31, 28, 25, 34, 27, 26, 33, 38, 35, 32, 39, 40, 43, 36, 37, 42, 41, 48, 49, 52, 45, 44, 53, 50, 47, 54, 55, 46, 51, 56, 57, 70, 61, 66, 65, 62, 69, 58, 73, 64, 63, 68, 59, 72, 67, 60 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

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

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.

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

LINKS

Zak Seidov, Table of n, a(n) for n = 1..10000 (First 1000 terms from T. D. Noe)

N. J. A. Sloane, Table of n, a(n) for n = 1..100000 (computed using Orlovsky's Mma program)

Index entries for sequences that are permutations of the natural numbers

EXAMPLE

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.

MAPLE

A055265 := proc(n)

    local a, i, known ;

    option remember;

    if n =1 then

        1;

    else

        for a from 1 do

            known := false;

            for i from 1 to n-1 do

                if procname(i) = a then

                    known := true;

                    break;

                end if;

            end do:

            if not known and isprime(procname(n-1)+a) then

                return a;

            end if;

        end do:

    end if;

end proc:

seq(A055265(n), n=1..100) ; # R. J. Mathar, Feb 25 2017

MATHEMATICA

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 *)

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 *)

PROG

(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 >> >> [From Gerald Hillier, Oct 28 2008]

(Haskell)

import Data.List (delete)

a055265 n = a055265_list !! (n-1)

a055265_list = 1 : f 1 [2..] where

   f x vs = g vs where

     g (w:ws) = if a010051 (x + w) == 1

                   then w : f w (delete w vs) else g ws

-- Reinhard Zumkeller, Feb 14 2013

(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

CROSSREFS

Inverse permutation: A117922; fixed points: A117925; A117923=a(a(n)). - Reinhard Zumkeller, Apr 03 2006

Cf. A036440, A051237, A051239, A055266, A088643. A010051.

Cf. A086527 (the primes a(n)+a(n-1)).

Cf. A070942 (n's such that a(1..n) is a permutation of (1..n)). - Moshe Levin, Oct 19 2011

See also A076990, A243625.

See A282695 for deviation from identity sequence.

A073659 is a version where the partial sums must be primes.

Sequence in context: A267308 A264965 A266644 * A117922 A266643 A263273

Adjacent sequences:  A055262 A055263 A055264 * A055266 A055267 A055268

KEYWORD

easy,nice,nonn

AUTHOR

Henry Bottomley, May 09 2000

EXTENSIONS

Corrected by Hans Havermann, Sep 24 2002

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified August 19 07:12 EDT 2017. Contains 290794 sequences.