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!)
A203602 Inverse permutation to A092401. 2
1, 3, 2, 5, 7, 4, 9, 11, 13, 15, 17, 6, 19, 21, 8, 23, 25, 27, 29, 31, 10, 33, 35, 12, 37, 39, 14, 41, 43, 16, 45, 47, 18, 49, 51, 53, 55, 57, 20, 59, 61, 22, 63, 65, 67, 69, 71, 24, 73, 75, 26, 77, 79, 28, 81, 83, 30, 85, 87, 32, 89, 91, 93, 95, 97, 34, 99 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
a(n) = -2*(Sum_{k=0..-1+floor(log(n)/log(3))} (-1)^k*floor(n/3^(k+1)))*(-1 + (floor(log(3*n)/log(3)) mod 2)+Sum_{k=1..floor(log(n)/log(3))} (-1)^k*(-ceiling(n/3^k) + floor(n/3^k))) + (-1 + 2*Sum_{k=0..floor(log(n)/log(3))} (-1)^k*floor(n/3^k))*((floor(log(3*n)/log(3)) mod 2)+Sum_{k=1..floor(log(n)/log(3))} (-1)^k*(-ceiling(n/3^k) + floor(n/3^k))). - Daniel Hoying, Aug 06 2020
MATHEMATICA
div[n_, m_]=Floor[n/m // Chop]-Ceiling[n/m // Chop](*n not divisible by m=>-1, else 0*); ind[m_]:=Sum[(-1)^(n) div[m, 3^n], {n, 1, Floor[Log[m]/Log[3] // FullSimplify]}] + Mod[Floor[Log[3 m]/Log[3] // FullSimplify], 2]; (* returns 0 or 1 depending on if we have an 'n' term (=>1) or a '3n' term (=>0) *) f[m_] := (2* Sum[(-1)^(n) Floor[m/(3^(n)) // FullSimplify], {n, 0, Floor[Log[m]/Log[3] // FullSimplify]}] - 1)* ind[m] + (1 - ind[m]) (2* Sum[(-1)^(n) Floor[m/(3^(n + 1)) // FullSimplify], {n, 0, -1 + Floor[Log[m]/Log[3] // FullSimplify]}]);
Table[f[k], {k, 1, 50}] (* Daniel Hoying, Aug 06 2020 *)
PROG
(Haskell)
import Data.List (elemIndex)
import Data.Maybe (mapMaybe)
a203602 n = a203602_list !! (n-1)
a203602_list = map (+ 1) $ mapMaybe (`elemIndex` a092401_list) [1..]
CROSSREFS
Sequence in context: A115966 A338744 A338745 * A249559 A182846 A292962
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 03 2012
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 14:32 EDT 2024. Contains 371914 sequences. (Running on oeis4.)