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.

A302041 An omega analog for a nonstandard factorization based on the sieve of Eratosthenes (A083221).

This page as a plain text file.
%I A302041 #15 Apr 02 2018 21:20:39
%S A302041 0,1,1,1,1,2,1,1,1,2,1,2,1,2,2,1,1,2,1,2,1,2,1,2,1,2,2,2,1,3,1,1,2,2,
%T A302041 2,2,1,2,2,2,1,2,1,2,1,2,1,2,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,1,2,3,1,2,
%U A302041 2,3,1,2,1,2,2,2,2,3,1,2,2,2,1,2,2,2,3,2,1,2,1,2,1,2,2,2,1,2,2,2,1,3,1,2,2
%N A302041 An omega analog for a nonstandard factorization based on the sieve of Eratosthenes (A083221).
%H A302041 Antti Karttunen, <a href="/A302041/b302041.txt">Table of n, a(n) for n = 1..65537</a>
%H A302041 <a href="/index/Si#sieve">Index entries for sequences generated by sieves</a>
%F A302041 a(1) = 0; for n > 1, a(n) = 1 + a(A302044(n)).
%F A302041 a(n) = A001221(A250246(n)).
%F A302041 a(n) = A069010(A252754(n)).
%o A302041 (PARI)
%o A302041 \\ Assuming A250469 and its inverse A268674 have been precomputed, then the following is reasonably fast:
%o A302041 A302044(n) = if(1==n,n,my(k=0); while((n%2), n = A268674(n); k++); n = (n/2^valuation(n, 2)); while(k>0, n = A250469(n); k--); (n));
%o A302041 A302041(n) = if(1==n, 0,1+A302041(A302044(n)));
%o A302041 (PARI)
%o A302041 up_to = 65537;
%o A302041 ordinal_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), pt); for(i=1, length(invec), if(mapisdefined(om,invec[i]), pt = mapget(om, invec[i]), pt = 0); outvec[i] = (1+pt); mapput(om,invec[i],(1+pt))); outvec; };
%o A302041 A020639(n) = if(n>1, if(n>n=factor(n, 0)[1, 1], n, factor(n)[1, 1]), 1); \\ From A020639
%o A302041 v078898 = ordinal_transform(vector(up_to,n,A020639(n)));
%o A302041 A078898(n) = v078898[n];
%o A302041 A000265(n) = (n/2^valuation(n, 2));
%o A302041 A302044(n) = { my(c = A000265(A078898(n))); if(1==c,1,my(p = prime(-1+primepi(A020639(n))+primepi(A020639(c))), d = A078898(c), k=0); while(d, k++; if((1==k)||(A020639(k)>=p),d -= 1)); (k*p)); };
%o A302041 A302041(n) = if(1==n, 0,1+A302041(A302044(n)));
%o A302041 (PARI)
%o A302041 \\ Or, using also some of the code from above:
%o A302041 A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From A003961
%o A302041 A055396(n) = if(1==n,0,primepi(A020639(n)));
%o A302041 A250246(n) = if(1==n,n,my(k = 2*A250246(A078898(n)), r = A055396(n)); if(1==r, k, while(r>1, k = A003961(k); r--); (k)));
%o A302041 A302041(n) = omega(A250246(n));
%Y A302041 Cf. A001221, A069010, A250246, A252754, A302044.
%Y A302041 Cf. A302040 (positions of terms < 2).
%Y A302041 Cf. A253557 (a similar analog for bigomega), A302050, A302051, A302052, A302039, A302055 (other analogs).
%Y A302041 Differs from A302031 for the first time at n=59, where a(59) = 1, while A302031(59) = 2.
%K A302041 nonn
%O A302041 1,6
%A A302041 _Antti Karttunen_, Mar 31 2018