Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A005812
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A005812 Weight of balanced ternary representation of n.
(Formerly M0111)
+0
1
0, 1, 2, 1, 2, 3, 2, 3, 2, 1, 2, 3, 2, 3, 4, 3, 4, 3, 2, 3, 4, 3, 4, 3, 2, 3, 2, 1, 2, 3, 2, 3, 4, 3, 4, 3, 2, 3, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 4, 5, 4, 3, 4, 3, 2, 3, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 4, 5, 4, 3, 4, 3, 2, 3, 4, 3, 4, 3, 2, 3, 2, 1, 2, 3, 2, 3, 4, 3, 4, 3, 2, 3, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 4, 5, 4, 3 (list; graph; listen)
OFFSET

0,3

REFERENCES

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Flajolet and Ramshaw, A note on Gray code..., SIAM J. Comput. 9 (1980), 142-158.

LINKS

Michael Gilleland, Some Self-Similar Integer Sequences

FORMULA

a(3n)=a(n), a(3n+1)=a(n)+1, a(9n+2)=a(n)+2, a(9n+5)=a(3n+2)+1, a(9n+8)=a(3n+2).

a(n) = sum{k>0, floor(|2*sin(n*pi/3^k)|)} - T. Suzuki (suzuki(AT)scio.co.jp), Sep 10 2006

PROGRAM

(Lisp) (defun btw (n) (if (= n 0) 0 (multiple-value-bind (q r) (round n 3) (+ (abs r) (btw q)))))

(PARI) a(n)=local(q); if(n<=0, 0, q=round(n/3); abs(n-3*q)+a(q))

CROSSREFS

Adjacent sequences: A005809 A005810 A005811 this_sequence A005813 A005814 A005815

Sequence in context: A147784 A051329 A105499 this_sequence A136625 A086520 A012265

KEYWORD

easy,nonn,nice

AUTHOR

N. J. A. Sloane (njas(AT)research.att.com), Jeffrey Shallit. Additional terms from Allan Wechsler (acw(AT)alum.mit.edu)

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 8 19:30 EST 2009. Contains 166227 sequences.


AT&T Labs Research