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.

A214371 If a(n) has not yet been defined then set a(n) = least positive integer that has not yet occurred; also if n>1 and a(n+a(n)) has not yet been defined then set a(n+a(n)) = a(n).

This page as a plain text file.
%I A214371 #31 Jun 13 2025 01:10:42
%S A214371 1,2,3,2,4,3,5,6,4,7,8,5,4,6,9,10,7,11,8,6,12,13,14,9,15,10,8,16,11,
%T A214371 17,18,19,12,20,13,10,14,21,22,15,23,24,25,16,12,10,17,13,18,26,19,27,
%U A214371 28,20,15,10,12,29,21,16,22,30,31,23,32,24,18,25,12,19,33
%N A214371 If a(n) has not yet been defined then set a(n) = least positive integer that has not yet occurred; also if n>1 and a(n+a(n)) has not yet been defined then set a(n+a(n)) = a(n).
%F A214371 a(1)=1, for n>1, a(n) = A214370(n-1)+1.
%t A214371 mex[a_]:=Module[{q}, q=1; While[MemberQ[a,q], q++]; q]; a = Table[0,{k, 1, 100}]; For[n=1, n<=100, n++, {If[a[[n]]==0, a[[n]] = mex[a]]; If[n>1, {nan = n+a[[n]]; If[(nan <= Length[a]) && (a[[nan]] == 0), a[[nan]] = a[[n]]]}]; }]; a
%o A214371 (Python)
%o A214371 SIZE = 300
%o A214371 a = [-8]*SIZE
%o A214371 top=0
%o A214371 for n in range(SIZE):
%o A214371     if a[n]==-8:       # if a[n] is undefined yet
%o A214371         top+=1
%o A214371         a[n]=top
%o A214371     if 1<n+a[n]<SIZE and a[n+a[n]]==-8:   # if a[n+a[n]] is undefined yet
%o A214371         a[n+a[n]]=a[n]
%o A214371     print(a[n], end=',')
%Y A214371 Cf. A214370.
%Y A214371 Cf. A026242, A026338.
%K A214371 nonn,easy
%O A214371 1,2
%A A214371 _Alex Ratushnyak_, Jul 14 2012