login
A143692
Permutation of natural numbers: If n is k-th number with an odd number of prime divisors (counted with multiplicity) [i.e., n = A026424(k)], a(n) = 2*k, otherwise, when n is k-th number with an even number of prime divisors [i.e., n = A028260(k)], a(n) = (2*k)-1.
4
1, 2, 4, 3, 6, 5, 8, 10, 7, 9, 12, 14, 16, 11, 13, 15, 18, 20, 22, 24, 17, 19, 26, 21, 23, 25, 28, 30, 32, 34, 36, 38, 27, 29, 31, 33, 40, 35, 37, 39, 42, 44, 46, 48, 50, 41, 52, 54, 43, 56, 45, 58, 60, 47, 49, 51, 53, 55, 62, 57, 64, 59, 66, 61, 63, 68, 70, 72, 65, 74, 76, 78
OFFSET
1,2
COMMENTS
a(a(n)) = A143694(n).
FORMULA
From Antti Karttunen, Jul 27 2014: (Start)
If A066829(n) = 1, then a(n) = 2 * A055038(n), otherwise a(n) = (2 * A055037(n)) - 1.
For all n >= 1, A000035(a(n)) = 1 - A066829(n). [Permutation A245603 has the same property].
(End)
MAPLE
N:= 1000: # to get a(1) to a(N)
Odds, Evens:= selectremove(t -> numtheory:-bigomega(t)::odd, [$1..N]):
for k from 1 to nops(Odds) do A[Odds[k]]:= 2*k od:
for k from 1 to nops(Evens) do A[Evens[k]]:= 2*k-1 od:
seq(A[k], k=1..N); # Robert Israel, Jul 27 2014
MATHEMATICA
m = 100;
odds = Select[Range[m], OddQ[PrimeOmega[#]]&];
evens = Select[Range[m], EvenQ[PrimeOmega[#]]&];
Do[a[odds[[k]]] = 2k, {k, 1, Length[odds]}];
Do[a[evens[[k]]] = 2k-1, {k, 1, Length[evens]}];
Array[a, m] (* Jean-François Alcover, Mar 09 2019, from Maple *)
PROG
(MIT/GNU Scheme) (define (A143692 n) (if (= 1 (A066829 n)) (* 2 (A055038 n)) (-1+ (* 2 (A055037 n)))))
(Haskell)
import Data.List (elemIndex); import Data.Maybe (fromJust)
a243692 = (+ 1) . fromJust . (`elemIndex` a143691_list)
-- Reinhard Zumkeller, Aug 07 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Aug 29 2008
EXTENSIONS
Name changed by Antti Karttunen, Jul 27 2014
STATUS
approved