This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A338362 #15 Apr 04 2023 03:21:53 %S A338362 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, %T A338362 30,31,32,34,35,37,38,20,39,40,41,23,43,44,45,47,48,50,51,27,52,54,55, %U A338362 56,57,58,59,61,62,63,64,33,65,67,68,36,70,71,72,73,74,76,77,78,79,81,82 %N A338362 Inverse permutation to A283312. %H A338362 N. J. A. Sloane, <a href="/A338362/b338362.txt">Table of n, a(n) for n = 1..10000</a> %F A338362 Let g(n) = A338363(n) = n + pi(n) - pi(n/2), where pi = A000720. %F A338362 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). %p A338362 g := m -> m+pi(m)-pi(m/2); # A338363 %p A338362 A338362 := proc(n) global g; %p A338362 if isprime(n) then return(g(n)-1); fi; %p A338362 if type(n,even) then %p A338362 if isprime(n/2) then return(g(n/2)); fi; %p A338362 fi; %p A338362 return(g(n)); end proc; %p A338362 [seq(A338362(n),n=1..128)]; %t A338362 g[n_] := n + PrimePi[n] - PrimePi[n/2]; %t A338362 a[n_] := Which[PrimeQ[n], g[n]-1, PrimeQ[n/2], g[n/2], True, g[n]]; %t A338362 Table[a[n], {n, 1, 128}] (* _Jean-François Alcover_, Apr 04 2023 *) %Y A338362 Cf. A000720, A283312, A338363. %K A338362 nonn %O A338362 1,2 %A A338362 _N. J. A. Sloane_, Nov 03 2020