Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #10 Jun 06 2024 03:50:38
%S 1,5,7,9,12,14,18,21,24,27,29,33,35,39,41,43,47,49,51,54,58,60,63,66,
%T 69,72,75,77,78,82,86,88,92,94,96,99,103,105,110,112,114,116,120,123,
%U 126,129,130,135,137,140,143,146,148,152,154,158,160,164,166,169,171,172
%N 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.
%p 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
%t 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]];
%t A075329[100] (* _Jean-François Alcover_, Jun 06 2024, after _R. J. Mathar_ *)
%Y Cf. A075330, A075331, A075332.
%K nonn
%O 1,2
%A _Amarnath Murthy_, Sep 18 2002
%E More terms from _R. J. Mathar_, Feb 03 2007