login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A246682 Permutation of natural numbers: a(1) = 0, a(2) = 1, and for n > 1, a(2n) = nthcomposite(a(n)), a(2n-1) = nthprime(a(A064989(2n-1))), where nthprime = A000040, nthcomposite = A002808, and A064989(n) shifts the prime factorization of n one step towards smaller primes. 6
0, 1, 2, 4, 3, 6, 5, 9, 7, 8, 11, 12, 31, 10, 13, 16, 127, 14, 709, 15, 19, 20, 5381, 21, 17, 46, 23, 18, 52711, 22, 648391, 26, 29, 166, 41, 24, 9737333, 858, 71, 25, 174440041, 30, 3657500101, 32, 37, 6186 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

COMMENTS

Note the indexing: the domain starts from 1, while the range includes also zero.

Has an infinite number of infinite cycles. See comments at A246681.

LINKS

Table of n, a(n) for n=1..46.

Index entries for sequences that are permutations of the natural numbers

FORMULA

a(1) = 0, a(2) = 1, and for n > 1, a(2n) = nthcomposite(a(n)), a(2n-1) = nthprime(a(A064989(2n-1))), where nthprime = A000040, nthcomposite = A002808, and A064989(n) shifts the prime factorization of n one step towards smaller primes.

As a composition of related permutations:

a(n) = A246378(A243071(n)).

Other identities.

For all n >= 1 the following holds:

a(A000040(n)) = A007097(n-1). [Maps primes to the iterates of primes].

A049076(a(A000040(n))) = n. [Follows from above].

For all n > 1 the following holds:

A010051(a(n)) = A000035(n). [Maps odd numbers larger than one to primes, and even numbers to composites, in some order. Permutations A246378 & A246380 have the same property].

PROG

(PARI)

default(primelimit, (2^31)+(2^30));

A002808(n) = { my(k=-1); while( -n + n += -k + k=primepi(n), ); n }; \\ This function from M. F. Hasler

A064989(n) = {my(f); f = factor(n); if((n>1 && f[1, 1]==2), f[1, 2] = 0); for (i=1, #f~, f[i, 1] = precprime(f[i, 1]-1)); factorback(f)};

A246682(n) = if(n < 3, n-1, if(!(n%2), A002808(A246682(n/2)), prime(A246682(A064989(n)))));

for(n=1, 46, write("b246682.txt", n, " ", A246682(n)));

(Scheme, two variants)

(definec (A246682 n) (cond ((<= n 2) (- n 1)) ((even? n) (A002808 (A246682 (/ n 2)))) (else (A000040 (A246682 (A064989 n))))))

(define (A246682 n) (A246378 (A243071 n)))

CROSSREFS

Inverse: A246681.

Similar or related permutations: A246376, A246378, A243071, A246368, A064216, A246380.

Cf. A000035, A000040, A002808, A007097, A010051, A064989, A049076, A078442.

Sequence in context: A281117 A227114 A281120 * A143691 A129767 A119618

Adjacent sequences:  A246679 A246680 A246681 * A246683 A246684 A246685

KEYWORD

nonn

AUTHOR

Antti Karttunen, Sep 01 2014

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 20 23:06 EST 2019. Contains 329348 sequences. (Running on oeis4.)