This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A294745 Lexicographically first sequence of distinct positive integers in which successive terms differ by distinct triangular numbers. 1

%I

%S 1,2,5,11,21,6,27,55,10,46,101,23,89,180,9,114,234,3,139,292,16,206,

%T 416,38,291,591,30,355,4,410,845,25,490,986,40,568,1163,35,665,1331,

%U 56,759,18,798,1659,63,966,1956,65,1100,19,1195,2420,74,1400,22,1453

%N Lexicographically first sequence of distinct positive integers in which successive terms differ by distinct triangular numbers.

%C a(1) = 1; for n > 1, a(n) is the smallest unused positive integer such that |a(n) - a(n-1)| is a triangular number (A000217) that has not already been used as the absolute difference between two successive terms.

%C This sequence differs from Recamán's sequence (A005132) in its starting value (1 vs. 0) and the absolute distance between its successive terms |a(n) - a(n-1)| (any unused triangular number vs. n).

%C Conjecture: this sequence is a permutation of the positive integers.

%C Terms that are less than all subsequent terms: a(1)=1, a(2)=2, a(18)=3, a(29)=4, a(157)=7, a(216)=8, a(254)=13, a(1220)=20; a(?)=33 (does not appear in the first 40000 terms).

%H Jon E. Schoenfield, <a href="/A294745/b294745.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 1 since all terms are positive integers and the sequence is lexicographically first.

%e Writing the k-th triangular number A000217(k) as T(k):

%e a(2) = 2 because 2 is the smallest unused positive number that differs from a(1)=1 by a triangular number: |2 - 1| = 1 = T(1);

%e a(3) = 5 because 5 is the smallest unused positive number that differs from a(2)=2 by a triangular number other than 1 (already used): |5 - 2| = 3 = T(2).

%e Similarly,

%e a(4) = 11: |11 - 5| = 6 = T(3);

%e a(5) = 21: |21 - 11| = 10 = T(4);

%e a(6) = 6: | 6 - 21| = 15 = T(5);

%e a(7) = 27: |27 - 6| = 21 = T(6);

%e a(8) = 55: |55 - 27| = 28 = T(7);

%e a(9) = 10: |10 - 55| = 45 = T(9) (T(8) has not yet been used, but 55 - 45 = 10 gives a smaller unused number than 55 - 36 = 19).

%o (MAGMA)

%o a:=[1]; TUsed:=[]; for n in [2..57] do tBest:=0; k:=0; while true do k+:=1; T:=(k*(k+1)) div 2; if not (T in TUsed) then t:=a[n-1]-T; if t lt 1 then break; end if; if not (t in a) then tBest:=t; end if; end if; end while; if tBest eq 0 then k:=0; while true do k+:=1; T:=(k*(k+1)) div 2; if not (T in TUsed) then t:=a[n-1]+T; if not (t in a) then tBest:=t; break; end if; end if; end while; end if; a[n]:=tBest; TUsed[#TUsed+1]:=Abs(a[n]-a[n-1]); end for; a;

%Y Cf. A000217 (triangular numbers), A005132 (Recamán's sequence).

%K nonn

%O 1,2

%A _Jon E. Schoenfield_, Dec 09 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified January 21 19:08 EST 2019. Contains 319350 sequences. (Running on oeis4.)