cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A075329 #10 Jun 06 2024 03:50:38
%S A075329 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 A075329 69,72,75,77,78,82,86,88,92,94,96,99,103,105,110,112,114,116,120,123,
%U A075329 126,129,130,135,137,140,143,146,148,152,154,158,160,164,166,169,171,172
%N 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.
%p A075329 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 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 A075329[100] (* _Jean-François Alcover_, Jun 06 2024, after _R. J. Mathar_ *)
%Y A075329 Cf. A075330, A075331, A075332.
%K A075329 nonn
%O A075329 1,2
%A A075329 _Amarnath Murthy_, Sep 18 2002
%E A075329 More terms from _R. J. Mathar_, Feb 03 2007