OFFSET
1,2
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..10000
MAPLE
A121229 := proc(n)
option remember;
local a, ispr, i;
if n <=2 then
n;
else
for a from procname(n-1)+1 do
ispr := false ;
for i from 1 to n-2 do
if procname(i)*procname(i+1) = a then
ispr := true ;
break;
end if;
end do:
if not ispr then
return a;
end if;
end do:
end if;
end proc: # R. J. Mathar, May 25 2017
MATHEMATICA
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]]]]];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Sep 23 2022, after R. J. Mathar *)
PROG
(Python)
from itertools import islice
def agen(): # generator of terms
disallowed, prevk, k = {1, 2}, 2, 3; yield from [1, 2]
while True:
while k in disallowed: k += 1
yield k; disallowed.update([k, k*prevk]); prevk = k
print(list(islice(agen(), 72))) # Michael S. Branicky, Sep 23 2022
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Giovanni Teofilatto, Aug 21 2006
STATUS
approved