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.

A113880 Variation on Recamán's sequence utilizing the four basic operations (/,-,+,*) in that order.

This page as a plain text file.
%I A113880 #48 Jan 13 2025 04:09:59
%S A113880 0,1,3,6,2,7,13,20,12,21,11,22,10,23,9,24,8,25,43,62,42,63,41,18,432,
%T A113880 407,381,354,326,297,267,236,204,171,137,102,66,29,67,28,68,27,69,26,
%U A113880 70,115,161,114,162,113,163,112,60,3180,3126,3071,3015,2958,51,110,50,111,49
%N A113880 Variation on Recamán's sequence utilizing the four basic operations (/,-,+,*) in that order.
%C A113880 More precisely:
%C A113880 a(n) = a(n-1)/n if a(n-1)/n is an integer and not already in the sequence. Else:
%C A113880 a(n) = a(n-1)-n if a(n-1)-n is positive and not already in the sequence. Else:
%C A113880 a(n) = a(n-1)+n if a(n-1)+n is not already in the sequence. Else:
%C A113880 a(n) = a(n-1)*n if a(n-1)*n is not already in the sequence. Else STOP.
%C A113880 In other words, divide if you can, else subtract, else add, else multiply.
%C A113880 By a(1000) there are 3 division steps, 928 subtraction steps, 59 addition steps and 10 multiplication steps. It is unlikely that every number belongs to the sequence since there are many "holes". It is an open question if there are any repetitions after a multiplication step. Can anybody expand the series?
%C A113880 At a(2500000000) = 2285684529311288243, there have been 44 divisions, 2499821613 subtractions, 178253 additions, and 90 multiplications. The largest value seen was a(1926305697) = 3555357710450807490. No multiplication step has produced a duplicate term. - _Benjamin Chaffin_, Sep 22 2016
%H A113880 Robert G. Wilson v, <a href="/A113880/b113880.txt">Table of n, a(n) for n = 0..10000</a>
%H A113880 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%e A113880 a(24) = 432 because:
%e A113880 - a(23) = 18,
%e A113880 - 18/24 is not an integer,
%e A113880 - 18 - 24 is negative,
%e A113880 - 18 + 24 = 42 is already in the sequence,
%e A113880 - 18 * 24 = 432 is not already in the sequence.
%t A113880 f[s_List] := Block[{l = s[[-1]], n = Length@ s}, If[ IntegerQ[l/n] && !MemberQ[s, l/n], Append[s, l/n], If[l > n && !MemberQ[s, l - n], Append[s, l - n], If[ !MemberQ[s, l + n], Append[s, l + n], Append[s, l*n]]]]]; Nest[f, {0}, 62] (* _Robert G. Wilson v_, Sep 10 2016 *)
%o A113880 (Python)
%o A113880 from itertools import count, islice
%o A113880 def A113880(): # generator of terms
%o A113880     aset, an = {0, 1}, 1
%o A113880     yield from [0, 1]
%o A113880     for n in count(2):
%o A113880         q, r = divmod(an, n)
%o A113880         if r == 0 and q not in aset: an = q
%o A113880         elif (d:=an-n) > 0 and d not in aset: an = d
%o A113880         elif (s:=an+n) not in aset: an = s
%o A113880         elif (m:=an*n) not in aset: an = m
%o A113880         else: return
%o A113880         yield an
%o A113880         aset.add(an)
%o A113880 print(list(islice(A113880(), 63))) # _Michael S. Branicky_, May 26 2023
%Y A113880 Cf. A005132.
%K A113880 nonn
%O A113880 0,3
%A A113880 _Sergio Pimentel_, Jan 27 2006
%E A113880 a(0) = 0 prepended by _Robert G. Wilson v_, Sep 10 2016