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

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A064365 a(1) = p(1) = 2 and a(n) = a(n-1)-p(n) if positive and new, otherwise a(n) = a(n-1)+p(n), where p(n) is the n-th prime. 4
2, 5, 10, 3, 14, 1, 18, 37, 60, 31, 62, 25, 66, 23, 70, 17, 76, 15, 82, 11, 84, 163, 80, 169, 72, 173, 276, 383, 274, 161, 34, 165, 28, 167, 316, 467, 310, 147, 314, 141, 320, 139, 330, 137, 334, 135, 346, 123, 350, 121, 354, 115, 356, 105, 362, 99, 368, 97, 374, 93 (list; graph; refs; listen; history; internal format)
OFFSET

1,1

COMMENTS

'Recaman transform' (see A005132) of the prime sequence.

Does every positive integer appear in the sequence? This seems unlikely, since 4 has not appeared in 70000 terms.

Note: this is similar to Clark Kimberling's A022831, with the added requirement that there be no repeated terms - in other words, A022831 has the above definition with the words 'and new' deleted.

LINKS

N. J. A. Sloane, First 70000 terms

Index entries for sequences related to Recaman's sequence

EXAMPLE

To find a(9) we try subtracting the 9th prime, which is 23, from a(8), which is 37. 37 - 23 = 14, but 14 is already in the sequence (it is a(5)), so we must add. a(9) = 37 + 23 = 60.

MATHEMATICA

a = {2}; Do[ If[ a[ [ -1 ] ] - Prime[ n ] > 0 && Position[ a, a[ [ -1 ] ] - Prime[ n ] ] == {}, a = Append[ a, a[ [ -1 ] ] - Prime[ n ] ], a = Append[ a, a[ [ -1 ] ] + Prime[ n ] ] ], {n, 2, 70} ]; a

CROSSREFS

Cf. A005132, A022831.

Sequence in context: A059955 A099796 A022831 * A177356 A078322 A194356

Adjacent sequences:  A064362 A064363 A064364 * A064366 A064367 A064368

KEYWORD

nonn,easy,nice

AUTHOR

N. Fernandez (primeness(AT)borve.org), Sep 25 2001

EXTENSIONS

More terms from Robert G. Wilson v (rgwv(AT)rgwv.com), Sep 26 2001. Further terms from N. J. A. Sloane (njas(AT)research.att.com), Feb 10, 2002

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

Content is available under The OEIS End-User License Agreement .

Last modified February 16 17:11 EST 2012. Contains 205938 sequences.