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.

A121229 Beginning with a(1) = 1 and a(2) = 2, a(n) is not equal to the product of two consecutive (distinct) earlier terms.

This page as a plain text file.
%I A121229 #24 Jul 23 2024 08:56:28
%S A121229 1,2,3,4,5,7,8,9,10,11,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,
%T A121229 29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,
%U A121229 53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,73,74,75,76,77,78
%N A121229 Beginning with a(1) = 1 and a(2) = 2, a(n) is not equal to the product of two consecutive (distinct) earlier terms.
%H A121229 N. J. A. Sloane, <a href="/A121229/b121229.txt">Table of n, a(n) for n = 1..10000</a>
%p A121229 A121229 := proc(n)
%p A121229     option remember;
%p A121229     local a,ispr,i;
%p A121229     if n <=2 then
%p A121229         n;
%p A121229     else
%p A121229         for a from procname(n-1)+1 do
%p A121229             ispr := false ;
%p A121229             for i from 1 to n-2 do
%p A121229                 if procname(i)*procname(i+1) = a then
%p A121229                     ispr := true ;
%p A121229                     break;
%p A121229                 end if;
%p A121229             end do:
%p A121229             if not ispr then
%p A121229                 return a;
%p A121229             end if;
%p A121229         end do:
%p A121229     end if;
%p A121229 end proc: # _R. J. Mathar_, May 25 2017
%t A121229 a[n_] := a[n] = Module[{k, ispr, i}, If[n <= 2, n, For[k = a[n - 1] + 1, True, k++, ispr = False; For[i = 1, i <= n - 2, i++, If[a[i]*a[i + 1] == k, ispr = True; Break[]]]; If[!ispr, Return[k]]]]];
%t A121229 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Sep 23 2022, after _R. J. Mathar_ *)
%o A121229 (Python)
%o A121229 from itertools import islice
%o A121229 def agen(): # generator of terms
%o A121229     disallowed, prevk, k = {1, 2}, 2, 3; yield from [1, 2]
%o A121229     while True:
%o A121229         while k in disallowed: k += 1
%o A121229         yield k; disallowed.update([k, k*prevk]); prevk = k
%o A121229 print(list(islice(agen(), 72))) # _Michael S. Branicky_, Sep 23 2022
%Y A121229 Cf. A005228, A030124.
%Y A121229 The complement is A286290, excluding the initial 1.
%K A121229 easy,nonn
%O A121229 1,2
%A A121229 _Giovanni Teofilatto_, Aug 21 2006