A090252 The Two-Up sequence: a(n) is the least positive number not already used that is coprime to the previous floor(n/2) terms.
1, 2, 3, 5, 4, 7, 9, 11, 13, 17, 8, 19, 23, 25, 21, 29, 31, 37, 41, 43, 47, 53, 16, 59, 61, 67, 71, 73, 55, 79, 27, 49, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 26, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 85, 121, 223, 227, 57, 229
Offset: 1
Keywords
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..34886
- Russ Cox, Table of nonprime entries in A090252: n, A090252(n), # of prime factors, n = 1..3527.
- Russ Cox, Table of n, a(n) for n = 1..5764982, up to the first term that is greater than 10^8 [gzipped file]
- Michael De Vlieger, Thomas Scheuerle, Rémy Sigrist, N. J. A. Sloane, and Walter Trump, The Binary Two-Up Sequence, arXiv:2209.04108 [math.CO], Sep 11 2022.
- N. J. A. Sloane, Blog post about the Two-Up sequence, June 13 2022.
- Hugo van der Sanden, Perl program to calculate this sequence and A249064 (requires Math::Pari)
- Hugo van der Sanden, Faster Perl program on github, used to compute 10^9 terms. [Link changed by _N. J. A. Sloane_, Jun 19 2022]
- Hugo van der Sanden, Table of nonprime entries in the first 10^9 terms of A090252 [See beginning of the file for description. The blog in the above link has comments from _Hugo van der Sanden_ describing the algorithm used to generate this table.]
Crossrefs
Programs
-
Mathematica
nn = 120; c[] = 0; a[1] = c[1] = 1; u = 2; Do[k = u; While[Nand[c[k] == 0, AllTrue[Array[a[i - #] &, Floor[i/2]], CoprimeQ[#, k] &]], k++]; Set[{a[i], c[k]}, {k, i}]; If[k == u, While[c[u] > 0, u++]], {i, 2, nn}]; Array[a, nn] (* _Michael De Vlieger, May 21 2022 *)
-
PARI
A090252_first(N, U=[0], L=List())=vector(N, i, for(k=U[1]+1, oo, setsearch(U, k) && next; foreach(L,m, gcd(k,m)>1 && next(2)); bitand(i,1) || listpop(L,1); listput(L,k); if( k>U[1]+1, U=setunion(U,[k]), U[1]++; while(#U>1 && U[2]==U[1]+1, U=U[^1]));break); L[#L]) \\ M. F. Hasler, Jun 14 2022
-
Python
from math import gcd, prod from itertools import count, islice def agen(): # generator of terms alst = [1]; aset = {1}; yield 1 mink = 2 for n in count(2): k, prodall = mink, prod(alst[n-n//2-1:n-1]) while k in aset or gcd(prodall, k) != 1: k += 1 alst.append(k); aset.add(k); yield k while mink in aset: mink += 1 print(list(islice(agen(), 64))) # Michael S. Branicky, May 21 2022
Extensions
More terms from David Wasserman, Oct 24 2005
Comments