OFFSET
1,2
COMMENTS
Permutation of the positive integers.
In other words, a(n) is the least positive unused integer such that Möbius(a(n)) is respectively 1, -1, 0, 1, -1, 0, 1, -1, 0, ... for n > 0.
LINKS
Winston de Greef, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 1 because 1 is the smallest positive integer with Möbius(1) = 1.
For a(2) we search for the smallest positive integer k not already in the sequence with Möbius(k) = -1. So, a(2) = 2.
Next, we search for Möbius(k) = 0 and a(3) = 6. We continue by asking for the smallest k such that Möbius(k) = 1, -1, 0, 1, -1, 0, ... and so on.
MATHEMATICA
a[1]=1; a[n_]:=a[n]=(k=1; While[MemberQ[Array[a, n-1], k]||Mod[n, 3, -1]!=MoebiusMu@k, k++]; k); Array[a, 100]
PROG
(PARI) lista(n)=my(v=vector(n), k=[1, 1, 1]); for(i=1, n, my(m=i%3); while((moebius(k[m+1])-m) % 3, k[m+1]++); v[i]=k[m+1]; k[m+1]++; ); v \\ Winston de Greef, Mar 25 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Giorgos Kalogeropoulos, Dec 09 2021
STATUS
approved