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!)
A126759 a(0) = 1; a(2n) = a(n); a(3n) = a(n); otherwise write n = 6i+j, where j = 1 or 5 and set a(n) = 2i+2 if j = 1, otherwise a(n) = 2i+3. 4

%I #29 Aug 13 2022 20:48:50

%S 1,2,2,2,2,3,2,4,2,2,3,5,2,6,4,3,2,7,2,8,3,4,5,9,2,10,6,2,4,11,3,12,2,

%T 5,7,13,2,14,8,6,3,15,4,16,5,3,9,17,2,18,10,7,6,19,2,20,4,8,11,21,3,

%U 22,12,4,2,23,5,24,7,9,13,25,2,26,14,10,8,27,6,28,3,2,15,29,4,30,16,11,5,31,3

%N a(0) = 1; a(2n) = a(n); a(3n) = a(n); otherwise write n = 6i+j, where j = 1 or 5 and set a(n) = 2i+2 if j = 1, otherwise a(n) = 2i+3.

%C Invented by Miles Okazaki, who said: I was trying to write a composition that has the same melody going at several different speeds. If this sequence is mapped onto musical notes and you play every other term, you get the original sequence at half speed. If you play every third term, you again get the same melody. And every 4th term, 6th term, 8th term, 12th term, etc. yields the same result. The pattern generates itself, adding two new increasing integers every six terms.

%C The formula in the definition encapsulates this verbal description. - _N. J. A. Sloane_

%H N. J. A. Sloane, <a href="/A126759/b126759.txt">Table of n, a(n) for n = 0..10000</a>

%F For k > 1: a(A007310(k-1)) = k and a(m) < k for m < A007310(k-1). - _Reinhard Zumkeller_, Jun 16 2008

%F For n > 0: a(A007310(n)) = n and a(m) < n for m < A007310(n). - _Reinhard Zumkeller_, May 23 2013

%F a(0) = 1, a(2n) = a(n), a(3n) = a(n), a(6n+1) = 2n + 2, a(6n-1) = 2n + 1. [Essentially same as the original description, except the last clause expressed slightly differently.] - _Antti Karttunen_, Jan 28 2015

%p a:=proc(n) option remember; local i,j;

%p if n = 0 then RETURN(1); fi;

%p if n mod 2 = 0 then RETURN(a(n/2)); fi;

%p if n mod 3 = 0 then RETURN(a(n/3)); fi;

%p j := n mod 6; i := (n-j)/6;

%p if j = 1 then RETURN(2*i+2) else RETURN(2*i+3); fi;

%p end;

%p [seq(a(n),n=0..100)];

%t a[n_] := a[n] = Module[{i, j}, If[n == 0, Return[1]]; If[Mod[n, 2] == 0, Return[a[n/2]]]; If[Mod[n, 3] == 0, Return[a[n/3]]]; j = Mod[n, 6]; i = (n-j)/6; If[j == 1, Return[2*i+2], Return[2*i+3]]]; Table[a[n], {n, 0, 90}] (* _Jean-François Alcover_, Feb 11 2014, after Maple *)

%o (Haskell)

%o a126759 n = a126759_list !! n

%o a126759_list = 1 : f 1 where

%o f n = (case mod n 6 of 1 -> 2 * div n 6 + 2

%o 5 -> 2 * div n 6 + 3

%o 3 -> a126759 $ div n 3

%o _ -> a126759 $ div n 2) : f (n + 1)

%o -- _Reinhard Zumkeller_, May 23 2013

%o (Scheme)

%o (definec (A126759 n) (cond ((zero? n) 1) ((even? n) (A126759 (/ n 2))) ((zero? (modulo n 3)) (A126759 (/ n 3))) ((= 1 (modulo n 6)) (+ 2 (/ (- n 1) 3))) (else (+ 1 (/ (+ n 1) 3)))))

%o ;; _Antti Karttunen_, Jan 28 2015

%o (PARI) a(n) = if (n, if (!(n%2), a(n/2), if (!(n%3), a(n/3), my(k=n%6); if (k==1, 2*(n\6)+2, 2*(n\6)+3))), 1); \\ _Michel Marcus_, Aug 06 2022

%Y One more than A126760.

%Y Cf. A007310.

%K nonn,nice,hear

%O 0,2

%A _N. J. A. Sloane_, based on email from Miles Okazaki (milesokazaki(AT)gmail.com), Feb 18 2007

%E Typo in definition corrected by _Reinhard Zumkeller_, Jun 16 2008

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 07:42 EDT 2024. Contains 371905 sequences. (Running on oeis4.)