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.
%I A004793 #42 Feb 16 2025 08:32:28 %S A004793 1,3,4,6,10,12,13,15,28,30,31,33,37,39,40,42,82,84,85,87,91,93,94,96, %T A004793 109,111,112,114,118,120,121,123,244,246,247,249,253,255,256,258,271, %U A004793 273,274,276,280,282,283,285,325,327,328,330,334,336,337,339,352,354 %N A004793 a(1)=1, a(2)=3; a(n) is least k such that no three terms of a(1), a(2), ..., a(n-1), k form an arithmetic progression. %H A004793 Alois P. Heinz, <a href="/A004793/b004793.txt">Table of n, a(n) for n = 1..10000</a> %H A004793 F. Iacobescu, <a href="http://fs.unm.edu/SN/SPartitionType.pdf">Smarandache Partition Type and Other Sequences</a>, Bull. Pure Appl. Sci. 16E, 237-240, 1997. %H A004793 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/NonarithmeticProgressionSequence.html">Nonarithmetic Progression Sequence</a> %H A004793 <a href="/index/No#non_averaging">Index entries related to non-averaging sequences</a> %F A004793 a(n) = (3-n)/2 + 2*floor(n/2) + Sum_{k=1..n-1} 3^A007814(k)/2 = A003278(n) + [n is even], proved by Lawrence Sze, following a conjecture by _Ralf Stephan_. %F A004793 a(n) = b(n-1), with b(0)=1, b(2n) = 3b(n) - 2 - 3[n odd], b(2n+1) = 3b(n)-3[n odd]. %p A004793 a:= proc(n) local m, r, b; m, r, b:= n-1, 2-irem(n, 2), 1; %p A004793 while m>0 do r:= r+b*irem(m, 2, 'm'); b:= b*3 od; r %p A004793 end: %p A004793 seq(a(n), n=1..100); # _Alois P. Heinz_, Nov 02 2021 %t A004793 Select[Range[1000], MatchQ[IntegerDigits[#-1, 3], {(0|1)..., 0|2}]&] (* _Jean-François Alcover_, Jan 13 2019, after _Tanya Khovanova_ in A186776 *) %o A004793 (PARI) v[1]=1; v[2]=3; for(n=3,1000,f=2; m=v[n-1]+1; while(1, forstep(k=n-1,1,-1,if(v[k]<(m+1)/2,f=1; break); for(l=1,k-1,if(m-v[k]==v[k]-v[l],f=0; break)); if(f<2,break)); if(!f,m=m+1;f=2); if(f==1,break)); v[n]=m) \\ _Ralf Stephan_ %o A004793 (PARI) a(n)=if(n<1,1,if(n%2==0,3*a(n/2)-2-3*((n/2)%2),3*a((n-1)/2)-3*(((n-1)/2)%2))) \\ _Ralf Stephan_ %Y A004793 Equals A186776(n)+1, A033160(n)-1, A033163(n)-2. %Y A004793 Cf. A092482, A185256. %Y A004793 Row 1 of array in A093682. %K A004793 nonn %O A004793 1,2 %A A004793 _N. J. A. Sloane_, _Clark Kimberling_ %E A004793 Rechecked by _David W. Wilson_, Jun 04 2002