Variation (4) on Recamán's sequence (A005132): to get a(n), we first try to subtract n from a(n-1): a(n) = a(n-1) - n if positive and not already in the sequence; if not then we try to add n: a(n) = a(n-1) + n if not already in the sequence; if this fails we try to subtract n+1 from a(n-1), or to add n+1 to a(n-1), or to subtract n+2, or to add n+2, etc., until one of these produces a positive number not already in the sequence - this is a(n).

A064389

Variation (4) on Recamán's sequence (A005132): to get a(n), we first try to subtract n from a(n-1): a(n) = a(n-1) - n if positive and not already in the sequence; if not then we try to add n: a(n) = a(n-1) + n if not already in the sequence; if this fails we try to subtract n+1 from a(n-1), or to add n+1 to a(n-1), or to subtract n+2, or to add n+2, etc., until one of these produces a positive number not already in the sequence - this is a(n).

Terms

    a(0) =1a(1) =3a(2) =6a(3) =2a(4) =7a(5) =13a(6) =20a(7) =12a(8) =21a(9) =11a(10) =22a(11) =10a(12) =23a(13) =9a(14) =24a(15) =8a(16) =25a(17) =43a(18) =62a(19) =42a(20) =63a(21) =41a(22) =18a(23) =44a(24) =19a(25) =45a(26) =72a(27) =100a(28) =71a(29) =101

External references