login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A075329
Pair up the natural numbers as (r, s) (say) so that all natural numbers are obtained only once as r, s, s+r or s-r: (1, 3), (5, 11), (7, 15), (9, 19), (12, 25), (14, 31), (18, 38), ... Sequence gives first member of each pair.
4
1, 5, 7, 9, 12, 14, 18, 21, 24, 27, 29, 33, 35, 39, 41, 43, 47, 49, 51, 54, 58, 60, 63, 66, 69, 72, 75, 77, 78, 82, 86, 88, 92, 94, 96, 99, 103, 105, 110, 112, 114, 116, 120, 123, 126, 129, 130, 135, 137, 140, 143, 146, 148, 152, 154, 158, 160, 164, 166, 169, 171, 172
OFFSET
1,2
MAPLE
A075329 := proc(nmax) local r, s, n, stst, rtst ; r := [1] : s := [] : n := {1} : while nops(r) < 100 do stst := 1 ; while stst in n or stst-op(-1, r) in n or stst+op(-1, r) in n do stst := stst +1 ; od ; s := [op(s), stst] ; n := n union {stst, stst-op(-1, r), stst+op(-1, r)} ; rtst := 1 ; while rtst in n do rtst := rtst +1 ; od ; r := [op(r), rtst] ; n := n union {rtst} ; od : RETURN(r) ; end: A075329(100) ; # R. J. Mathar, Feb 03 2007
MATHEMATICA
A075329[nmax_] := Module[{r = {1}, s = {}, n = {1}, stst, rtst}, While[Length[r] < nmax, stst = 1; While[MemberQ[n, stst] || MemberQ[n, stst - Last[r]] || MemberQ[n, stst + Last[r]], stst++]; s = Append[s, stst]; n = n ~Union~ {stst, stst - Last[r], stst + Last[r]}; rtst = 1; While[MemberQ[n, rtst], rtst++]; r = Append[r, rtst]; n = n ~Union~ {rtst}]; Return[r]];
A075329[100] (* Jean-François Alcover, Jun 06 2024, after R. J. Mathar *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Sep 18 2002
EXTENSIONS
More terms from R. J. Mathar, Feb 03 2007
STATUS
approved