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

 

Logo

Annual appeal: Please make a donation to keep the OEIS running! Over 6000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A135141 a(1)=1, a(p_n)=2*a(n), a(c_n)=2*a(n)+1, where p_n = n-th prime, c_n = n-th composite number. 35
1, 2, 4, 3, 8, 5, 6, 9, 7, 17, 16, 11, 10, 13, 19, 15, 12, 35, 18, 33, 23, 21, 14, 27, 39, 31, 25, 71, 34, 37, 32, 67, 47, 43, 29, 55, 22, 79, 63, 51, 20, 143, 26, 69, 75, 65, 38, 135, 95, 87, 59, 111, 30, 45, 159, 127, 103, 41, 24, 287, 70, 53, 139, 151, 131, 77, 36, 271, 191 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

A permutation of the positive integers, related to A078442.

a(p) is even when p is prime and is divisible by 2^(prime order of p).

What is the length of the cycle containing 10? Is it infinite? The cycle begins 10, 17, 12, 11, 16, 15, 19, 18, 35, 29, 34, 43, 26, 31, 32, 67, 36, 55, 159, 1055, 441, 563, 100, 447, 7935, 274726911, 1013992070762272391167, ... Implementation in Mmca: NestList[a(AT)# &, 10, 26] Furthermore, it appears that any non-single digit number has an infinite cycle. (* Robert G. Wilson v, Feb 16 2008 *)

Records: 1, 2, 4, 8, 9, 17, 19, 35, 39, 71, 79, 143, 159, 287, 319, 575, 639, 1151, 1279, 2303, 2559, 4607, 5119, 9215, 10239, 18431, 20479, 36863, 40959, 73727, 81919, 147455, 163839, 294911, 327679, 589823, 655359, ..., . (* Robert G. Wilson v, Feb 16 2008 *)

LINKS

Robert G. Wilson v, Table of n, a(n) for n = 0..10000.

Index entries for sequences that are permutations of the natural numbers

FORMULA

a(n) = 2*A135141((A049084(n))*chip + A066246(n)*(1-chip)) + 1 - chip, where chip = a010051(n). - Reinhard Zumkeller, Jan 29 2014

EXAMPLE

a(20)=33=2*16+1 because 20 is 11th composite and a(11)=16. Or, a(20)=33=100001(bin). In other words it is a composite number, its index is a prime number, whose index is a prime....

MATHEMATICA

a[1] = 1; a[n_] := If[PrimeQ@n, 2*a[PrimePi[n]], 2*a[n - 1 - PrimePi@n] + 1]; Array[a, 69] (* Robert G. Wilson v, Feb 16 2008 *)

PROG

(Maxima) Let pc = prime count (which prime it is), cc = composite count:

pc[1]:0;

cc[1]:0;

pc[2]:1;

cc[4]:1;

pc[n]:=if primep(n) then 1+pc[prev_prime(n)] else 0;

cc[n]:=if primep(n) then 0 else if primep(n-1) then 1+cc[n-2] else 1+cc[n-1];

a[1]:1;

a[n]:=if primep(n) then 2*a[pc[n]] else 1+2*a[cc[n]];

(Haskell)

import Data.List (genericIndex)

a135141 n = genericIndex a135141_list (n-1)

a135141_list = 1 : map f [2..] where

   f x | iprime == 0 = 2 * (a135141 $ a066246 x) + 1

       | otherwise   = 2 * (a135141 iprime)

       where iprime = a049084 x

-- Reinhard Zumkeller, Jan 29 2014

(Python)

from sympy import isprime, primepi

def a(n): return 1 if n==1 else 2*a(primepi(n)) if isprime(n) else 2*a(n - 1 - primepi(n)) + 1 # Indranil Ghosh, Jun 11 2017, after Mathematica code

CROSSREFS

Cf. A078442.

Cf. A227413 (inverse), A026238.

Sequence in context: A048167 A207790 A269375 * A098709 A054238 A225589

Adjacent sequences:  A135138 A135139 A135140 * A135142 A135143 A135144

KEYWORD

nonn,look

AUTHOR

Katarzyna Matylla, Feb 13 2008

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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified December 14 21:25 EST 2017. Contains 296020 sequences.