login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A121229 Beginning with a(1) = 1 and a(2) = 2, a(n) is not equal to the product of two consecutive (distinct) earlier terms. 6

%I #21 Sep 24 2022 01:43:42

%S 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 29,30,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,

%U 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 Beginning with a(1) = 1 and a(2) = 2, a(n) is not equal to the product of two consecutive (distinct) earlier terms.

%H N. J. A. Sloane, <a href="/A121229/b121229.txt">Table of n, a(n) for n = 1..10000</a>

%p A121299 := proc(n)

%p option remember;

%p local a,ispr,i;

%p if n <=2 then

%p n;

%p else

%p for a from procname(n-1)+1 do

%p ispr := false ;

%p for i from 1 to n-2 do

%p if procname(i)*procname(i+1) = a then

%p ispr := true ;

%p break;

%p end if;

%p end do:

%p if not ispr then

%p return a;

%p end if;

%p end do:

%p end if;

%p end proc: # _R. J. Mathar_, May 25 2017

%t 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 Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Sep 23 2022, after _R. J. Mathar_ *)

%o (Python)

%o from itertools import islice

%o def agen(): # generator of terms

%o disallowed, prevk, k = {1, 2}, 2, 3; yield from [1, 2]

%o while True:

%o while k in disallowed: k += 1

%o yield k; disallowed.update([k, k*prevk]); prevk = k

%o print(list(islice(agen(), 72))) # _Michael S. Branicky_, Sep 23 2022

%Y Cf. A005228, A030124.

%Y The complement is A286290, excluding the initial 1.

%K easy,nonn

%O 1,2

%A _Giovanni Teofilatto_, Aug 21 2006

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 10:28 EDT 2024. Contains 371779 sequences. (Running on oeis4.)