login
An analog of Möbius function (A008683) for nonstandard factorization based on the sieve of Eratosthenes (A083221).
11

%I #10 Apr 03 2018 15:10:45

%S 1,-1,-1,0,-1,1,-1,0,0,1,-1,0,-1,1,1,0,-1,0,-1,0,0,1,-1,0,0,1,1,0,-1,

%T -1,-1,0,0,1,1,0,-1,1,1,0,-1,0,-1,0,0,1,-1,0,0,0,0,0,-1,-1,0,0,0,1,-1,

%U 0,-1,1,1,0,1,0,-1,0,0,-1,-1,0,-1,1,1,0,1,-1,-1,0,0,1,-1,0,0,1,-1,0,-1,0,0,0,0,1,1,0,-1,0,1,0,-1,0,-1,0,0

%N An analog of Möbius function (A008683) for nonstandard factorization based on the sieve of Eratosthenes (A083221).

%H Antti Karttunen, <a href="/A302050/b302050.txt">Table of n, a(n) for n = 1..65537</a>

%H <a href="/index/Si#sieve">Index entries for sequences generated by sieves</a>

%F a(1) = 1; for n > 1, if A302045(n) > 1, then a(n) = 0, otherwise a(n) = -1*a(A302044(n)).

%F a(n) = A008683(A250246(n)).

%o (PARI)

%o up_to = 65537;

%o 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 A020639(n) = if(n>1, if(n>n=factor(n, 0)[1, 1], n, factor(n)[1, 1]), 1); \\ From A020639

%o v078898 = ordinal_transform(vector(up_to,n,A020639(n)));

%o A078898(n) = v078898[n];

%o A000265(n) = (n/2^valuation(n, 2));

%o A001511(n) = 1+valuation(n,2);

%o A302045(n) = A001511(A078898(n));

%o 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 A302050(n) = if(1==n,n,if(A302045(n)>1,0,-1*A302050(A302044(n))));

%o (PARI)

%o \\ Or, using also some of the code from above:

%o A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From A003961

%o A055396(n) = if(1==n,0,primepi(A020639(n)));

%o 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 A302050(n) = moebius(A250246(n));

%Y Cf. A008683, A083221, A250246, A302044, A302045.

%Y Cf. also A253557, A302041, A302051, A302052, A302039, A302055 for other similar analogs.

%K sign

%O 1

%A _Antti Karttunen_, Apr 01 2018