

A285712


a(1) = 0, and for n > 1, if n = 3k1, then a(n) = k, otherwise a(n) = (A064216(n)+1)/2.


12



0, 1, 2, 3, 2, 4, 6, 3, 7, 9, 4, 10, 5, 5, 12, 15, 6, 8, 16, 7, 19, 21, 8, 22, 13, 9, 24, 11, 10, 27, 30, 11, 17, 31, 12, 34, 36, 13, 18, 37, 14, 40, 20, 15, 42, 28, 16, 26, 45, 17, 49, 51, 18, 52, 54, 19, 55, 29, 20, 33, 25, 21, 14, 57, 22, 64, 43, 23, 66, 69, 24, 39, 35, 25, 70, 75, 26, 44, 76, 27, 48, 79, 28, 82, 61, 29, 84, 23, 30, 87, 90, 31, 47, 46, 32
(list;
graph;
refs;
listen;
history;
text;
internal format)



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*k1, 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

(Scheme) (define (A285712 n) (cond ((<= n 1) ( n 1)) ((= 2 (modulo n 3)) (A002264 (+ 1 n))) (else (/ (+ 1 (A064216 n)) 2))))


CROSSREFS

Cf. A002264, A048673, A064216, A245612, A285713, A285714.
Sequence in context: A328880 A291290 A006047 * A062068 A328219 A328879
Adjacent sequences: A285709 A285710 A285711 * A285713 A285714 A285715


KEYWORD

nonn


AUTHOR

Antti Karttunen, Apr 25 2017


STATUS

approved



