cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A126759 #29 Aug 13 2022 20:48:50
%S A126759 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 A126759 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 A126759 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 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.
%C A126759 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 A126759 The formula in the definition encapsulates this verbal description. - _N. J. A. Sloane_
%H A126759 N. J. A. Sloane, <a href="/A126759/b126759.txt">Table of n, a(n) for n = 0..10000</a>
%F A126759 For k > 1: a(A007310(k-1)) = k and a(m) < k for m < A007310(k-1). - _Reinhard Zumkeller_, Jun 16 2008
%F A126759 For n > 0: a(A007310(n)) = n and a(m) < n for m < A007310(n). - _Reinhard Zumkeller_, May 23 2013
%F A126759 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 A126759 a:=proc(n) option remember; local i,j;
%p A126759 if n = 0 then RETURN(1); fi;
%p A126759 if n mod 2 = 0 then RETURN(a(n/2)); fi;
%p A126759 if n mod 3 = 0 then RETURN(a(n/3)); fi;
%p A126759 j := n mod 6; i := (n-j)/6;
%p A126759 if j = 1 then RETURN(2*i+2) else RETURN(2*i+3); fi;
%p A126759 end;
%p A126759 [seq(a(n),n=0..100)];
%t A126759 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 A126759 (Haskell)
%o A126759 a126759 n = a126759_list !! n
%o A126759 a126759_list = 1 : f 1 where
%o A126759    f n = (case mod n 6 of 1 -> 2 * div n 6 + 2
%o A126759                           5 -> 2 * div n 6 + 3
%o A126759                           3 -> a126759 $ div n 3
%o A126759                           _ -> a126759 $ div n 2) : f (n + 1)
%o A126759 -- _Reinhard Zumkeller_, May 23 2013
%o A126759 (Scheme)
%o A126759 (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 A126759 ;; _Antti Karttunen_, Jan 28 2015
%o A126759 (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 A126759 One more than A126760.
%Y A126759 Cf. A007310.
%K A126759 nonn,nice,hear
%O A126759 0,2
%A A126759 _N. J. A. Sloane_, based on email from Miles Okazaki (milesokazaki(AT)gmail.com), Feb 18 2007
%E A126759 Typo in definition corrected by _Reinhard Zumkeller_, Jun 16 2008