A359857 a(1) = 1, a(2) = 2, and let i,j represent a(n-2), a(n-1) respectively. For n > 2: If only one of i,j is prime, a(n) = least novel multiple of i+j. If i,j are both prime, a(n) = least novel multiple of i*j. If both i,j are nonprime, a(n) is least novel k prime to both i and j.
1, 2, 3, 6, 9, 5, 14, 19, 33, 52, 7, 59, 413, 472, 11, 483, 494, 17, 511, 528, 13, 541, 7033, 7574, 15, 23, 38, 61, 99, 160, 29, 189, 218, 25, 21, 4, 31, 35, 66, 37, 103, 3811, 3914, 27, 41, 68, 109, 177, 286, 43, 329, 372, 53, 425, 478, 39, 47, 86, 133, 45, 8
Offset: 1
Keywords
Examples
a(3) = 3 since only one of a(1), a(2) is prime and i+j = 3 has not occurred previously. a(4) = 6 since a(2) = 2 and a(3) = 3 are both prime and i*j = 6 has not occurred previously. a(6) = 5 since a(4) = 6 and a(5) = 9 are both composite, and 5 is the least novel number prime to both.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
Python
from math import gcd from sympy import isprime from itertools import count, islice def agen(): i, j, pi, pj, mink, aset = 1, 2, 0, 1, 3, {1, 2} yield from [i, j] while True: if pi^pj: k, m = max(mink//(i+j), 1), i+j while m*k in aset: k += 1 elif pi&pj: k, m = max(mink//(i*j), 1), i*j while m*k in aset: k += 1 else: k, m = mink, 1 while k in aset or gcd(k, i) != 1 or gcd(k, j) != 1: k += 1 an = m*k i, j, pi, pj = j, an, pj, int(isprime(an)); yield an; aset.add(an) while mink in aset: mink += 1 print(list(islice(agen(), 36))) # Michael S. Branicky, Jan 16 2023
Extensions
a(31)=29 inserted and a(38) and beyond from Michael S. Branicky, Jan 16 2023
Comments