login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338362 Inverse permutation to A283312. 3
1, 2, 4, 3, 6, 5, 8, 10, 11, 7, 12, 14, 15, 9, 17, 18, 19, 21, 22, 24, 25, 13, 26, 28, 29, 16, 30, 31, 32, 34, 35, 37, 38, 20, 39, 40, 41, 23, 43, 44, 45, 47, 48, 50, 51, 27, 52, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 33, 65, 67, 68, 36, 70, 71, 72, 73, 74, 76, 77, 78, 79, 81, 82 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
Let g(n) = A338363(n) = n + pi(n) - pi(n/2), where pi = A000720.
Then a(n) = g(n)-1 if n is a prime, a(n) = g(n/2) if n is twice a prime, and otherwise a(n) = g(n).
MAPLE
g := m -> m+pi(m)-pi(m/2); # A338363
A338362 := proc(n) global g;
if isprime(n) then return(g(n)-1); fi;
if type(n, even) then
if isprime(n/2) then return(g(n/2)); fi;
fi;
return(g(n)); end proc;
[seq(A338362(n), n=1..128)];
MATHEMATICA
g[n_] := n + PrimePi[n] - PrimePi[n/2];
a[n_] := Which[PrimeQ[n], g[n]-1, PrimeQ[n/2], g[n/2], True, g[n]];
Table[a[n], {n, 1, 128}] (* Jean-François Alcover, Apr 04 2023 *)
CROSSREFS
Sequence in context: A338618 A114792 A113324 * A281117 A227114 A354373
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 03 2020
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 11:06 EDT 2024. Contains 371905 sequences. (Running on oeis4.)