OFFSET
1,3
COMMENTS
For n >= 2, a(n) gives the contents of the parent node of the node containing n in binary trees like A245612.
Every positive integer greater than one occurs exactly twice in this sequence.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..8192
FORMULA
a(1) = 0, and for n > 1, if n = 3*k-1, then a(n) = k, otherwise a(n) = (A064216(n)+1)/2.
a(n) = (n+1)/3 + (3*A064216(n) - 2*n + 1)*( (n+1)^2 mod 3 )/6, for n>1. - Ammar Khatab, Sep 21 2020
MATHEMATICA
a[n_] := a[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; Array[a, 95] (* Michael De Vlieger, Sep 22 2017 *)
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 25 2017
STATUS
approved