|
Search: id:A064365
|
|
|
| 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. |
|
+0 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; listen)
|
|
|
OFFSET
|
1,1
|
|
|
COMMENT
|
'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 this_sequence A078322 A126842 A140469
Adjacent sequences: A064362 A064363 A064364 this_sequence 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 njas, Feb 10, 2002
|
|
|
Search completed in 0.002 seconds
|