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.

A354790 a(n) is the least positive squarefree number not already used that is coprime to the previous floor(n/2) terms.

This page as a plain text file.
%I A354790 #89 Aug 03 2024 11:14:08
%S A354790 1,2,3,5,7,11,6,13,17,19,23,29,31,35,22,37,39,41,43,47,53,59,61,67,71,
%T A354790 73,79,83,85,89,14,97,101,103,33,107,109,113,127,131,137,139,149,151,
%U A354790 157,163,167,173,179,181,191,193,197,199,211,223,227,229,65,233
%N A354790 a(n) is the least positive squarefree number not already used that is coprime to the previous floor(n/2) terms.
%C A354790 A version of the Two-Up sequence A090252 that is restricted to squarefree numbers.
%H A354790 Rémy Sigrist, <a href="/A354790/b354790.txt">Table of n, a(n) for n = 1..10000</a>
%H A354790 Thomas Scheuerle, <a href="/A354790/a354790_7.txt">Comments on A354790</a> regarding the possibility of composites with more than two factors.
%H A354790 Rémy Sigrist, <a href="/A354790/a354790_1.txt">Table of n, a(n) for n = 1..100000</a>
%H A354790 Rémy Sigrist, <a href="/A354790/a354790_8.txt">PARI program with comments</a>
%H A354790 Rémy Sigrist, <a href="/A354790/a354790.txt">C program</a> (inspired by Russ Cox's Go program for A247665)
%H A354790 Michael De Vlieger, <a href="/A354790/a354790.png">Compact annotated plot of prime p | A354790(n) at (n, pi(p)) for composite A354790(n)</a>, n <= 1500. Color function indicates the number k > 1 of appearances of divisor p in the sequence. Diagram supports a proposition similar to Conjecture 3 in A090252 but regarding this sequence. Indices n connected in red appear in A355897.
%H A354790 Michael De Vlieger, <a href="/A354790/a354790_1.png">Comprehensive annotated plot of prime p | A354790(n) at (n, pi(p)) for composite A354790(n)</a>, n <= 10^5. Color function indicates the number k > 1 of appearances of divisor p in the sequence.
%p A354790 # A354790 = Squarefree version of the Two-Up sequence A090252
%p A354790 # This produces 2*M terms in the array a
%p A354790 # Assumes b117 is a list of sufficiently many squarefree numbers A005117
%p A354790 # Test if u is relatively prime to all of a[i], i = i1..i2
%p A354790 perpq:=proc(u,i1,i2) local i; global a;
%p A354790 for i from i1 to i2 do if igcd(u,a[i])>1 then return(-1); fi; od: 1; end;
%p A354790 a:=Array(1..10000,-1);
%p A354790 hit:=Array(1..10000,-1); # 1 if i has appeared
%p A354790 a[1]:=1; a[2]:=2; hit[1]:=1; hit[2]:=1;
%p A354790 M:=100; M1 := 1000;
%p A354790 for p from 2 to M do
%p A354790 # step 1 want a[2p-1] relatively prime to a[p] ... a[2p-2]
%p A354790 sw1:=-1;
%p A354790 for j from 1 to M1 do
%p A354790 c:=b117[j];
%p A354790 if hit[c] = -1 and perpq(c,p,2*p-2) = 1 then a[2*p-1]:=c; hit[c]:=1; sw1:=1; break; fi;
%p A354790 od: # od j
%p A354790 if sw1 = -1 then error("no luck, step 1, p =",p ); fi;
%p A354790 # step 2 want a[2p] relatively prime to a[p] ... a[2p-1]
%p A354790 sw2:=-1;
%p A354790 for j from 1 to M1 do
%p A354790 c:=b117[j];
%p A354790 if hit[c] = -1 and perpq(c,p,2*p-1) = 1 then a[2*p]:=c; hit[c]:=1; sw2:=1; break; fi;
%p A354790 od: # od j
%p A354790 if sw2 = -1 then error("no luck, step 2, p =",p ); fi;
%p A354790 od: # od p
%p A354790 [seq(a[i],i=1..2*M)];
%t A354790 nn = 60; pp[_] = 1; k = r = 1; c[_] = False; a[1] = 1; Do[Set[m, SelectFirst[Union@ Append[Times @@ # & /@ Subsets[#, {2, Infinity}], Prime[r]] &[Prime@ Select[Range[If[k == 1, r, k + 1]], p[Prime[#]] < n &]], ! c[#] &]]; Set[a[n], m]; (c[m] = True; If[PrimeQ[m], r++]; If[n > 1, Map[(Set[p[#], 2 n]; pp[#]++) &, #]]) &@ FactorInteger[m][[All, 1]]; While[pp[Prime[k]] > 2, k++], {n, 2, nn}]; Array[a, nn] (* _Michael De Vlieger_, Sep 06 2022 *)
%o A354790 (PARI) \\ See Links section.
%o A354790 (Python)
%o A354790 from math import lcm, gcd
%o A354790 from itertools import count, islice
%o A354790 from collections import deque
%o A354790 from sympy import factorint
%o A354790 def A354790_gen(): # generator of terms
%o A354790     aset, aqueue, c, b, f = {1}, deque([1]), 2, 1, True
%o A354790     yield 1
%o A354790     while True:
%o A354790         for m in count(c):
%o A354790             if m not in aset and gcd(m,b) == 1 and all(map(lambda n:n<=1,factorint(m).values())):
%o A354790                 yield m
%o A354790                 aset.add(m)
%o A354790                 aqueue.append(m)
%o A354790                 if f: aqueue.popleft()
%o A354790                 b = lcm(*aqueue)
%o A354790                 f = not f
%o A354790                 while c in aset:
%o A354790                     c += 1
%o A354790                 break
%o A354790 A354790_list = list(islice(A354790_gen(),30)) # _Chai Wah Wu_, Jul 17 2022
%o A354790 (C) // See Links section.
%Y A354790 Cf. A090252, A247665, A354169.
%Y A354790 See A354791 and A354792 for the nonprime terms.
%Y A354790 See A355895 for the even terms.
%K A354790 nonn
%O A354790 1,2
%A A354790 _Michael De Vlieger_ and _N. J. A. Sloane_, Jul 17 2022
%E A354790 More terms from _Rémy Sigrist_, Jul 17 2022