Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A117128
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A117128 Recaman transform of primes (another version): a(0)=1; for n>0, a(n) = a(n-1) - prime(n) if that number is positive and not already in the sequence, otherwise a(n) = a(n-1) + prime(n). +0
3
1, 3, 6, 11, 4, 15, 2, 19, 38, 61, 32, 63, 26, 67, 24, 71, 18, 77, 16, 83, 12, 85, 164, 81, 170, 73, 174, 277, 384, 275, 162, 35, 166, 29, 168, 317, 468, 311, 148, 315, 142, 321, 140, 331, 138, 335, 136, 347, 124, 351, 122, 355, 116, 357, 106, 363, 100, 369, 98, 375, 94, 377 (list; graph; listen)
OFFSET

0,2

COMMENT

Equals A064365(n) - 1. Differs from Cald's sequence A006509 for first time at n=116 (or 117, depending on offset).

MAPLE

M1:=500000; a:=array(0..M1); have:=array(1..M1); a[0]:=1; for n from 1 to M1 do have[n]:=0; od: have[1]:=1;

M2:=2000; nmax:=M2;

for n from 1 to M2 do p:=ithprime(n); i:=a[n-1]-p; j:=a[n-1]+p;

if i >= 1 and have[i]=0 then a[n]:=i; have[i]:=1;

elif j <= M1 then a[n]:=j; have[j]:=1;

else nmax:=n-1; break; fi; od: [seq(a[n], n=0..M2)];

CROSSREFS

Cf. A064365, A006509, A112877.

Sequence in context: A083462 A110080 A093903 this_sequence A006509 A102889 A028744

Adjacent sequences: A117125 A117126 A117127 this_sequence A117129 A117130 A117131

KEYWORD

nonn

AUTHOR

njas, Apr 20 2006

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 18 20:14 EST 2008. Contains 147244 sequences.


AT&T Labs Research