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.

A375118 Let {b(m)} be Recamán's sequence A005132, with the additional term b(-1):=0. Define a(n) to be the first index m where b(m-1)-m = -n, or -1 if b(m-1)-m never equals -n.

This page as a plain text file.
%I A375118 #14 Aug 01 2024 19:12:13
%S A375118 0,1,181695,5,1523,137,15,1525,139,17,1527,141,28,1529,143,30,1531,
%T A375118 145,32,1533,147,53,1535,149,55,1537,151,57,1539,153,59,1541,155,61,
%U A375118 1543,157,63,1545,159,65,1547,161,276,1549,163,278,1551,165,280,1553,167,282
%N A375118 Let {b(m)} be Recamán's sequence A005132, with the additional term b(-1):=0. Define a(n) to be the first index m where b(m-1)-m = -n, or -1 if b(m-1)-m never equals -n.
%C A375118 This sequence is interesting because of the spike at the 2nd term.
%C A375118 The next similar spike occurs at a(59)=181733.
%e A375118 Recamán's sequence {b(m)} begins with 0, 1, 3, 6, 2, 7, 13,...
%e A375118 b(1-1)-1 = 0-1 = -1, so a(1) = 1.
%e A375118 b(5-1)-5 = 2-5 = -3, so a(3) = 5.
%o A375118 (Python)
%o A375118 def a(n):
%o A375118     a = [0]
%o A375118     for i in range(1,n):
%o A375118         a+=[-1]
%o A375118     countA = 1
%o A375118     seq = [0]
%o A375118     m = 1
%o A375118     while(countA < n):
%o A375118         x = seq[m-1]-m
%o A375118         if(x<0):
%o A375118             if(-x < n and a[-x]==-1):
%o A375118                 a[-x] = m
%o A375118                 countA+=1
%o A375118             seq+=[seq[m-1]+m]
%o A375118         else:
%o A375118             if(x not in seq):
%o A375118                 seq+=[x]
%o A375118             else:
%o A375118                 seq+=[seq[m-1]+m]
%o A375118         m+=1
%o A375118     return a #find all terms in range(0,n)
%Y A375118 Cf. A005132, A057167.
%K A375118 nonn
%O A375118 0,3
%A A375118 _Jens Askgaard_, Jul 30 2024