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.

A240400 Numbers n having a partition into distinct parts of form 3^k-2^k.

This page as a plain text file.
%I A240400 #34 Apr 08 2019 07:59:35
%S A240400 0,1,5,6,19,20,24,25,65,66,70,71,84,85,89,90,211,212,216,217,230,231,
%T A240400 235,236,276,277,281,282,295,296,300,301,665,666,670,671,684,685,689,
%U A240400 690,730,731,735,736,749,750,754,755,876,877,881,882,895,896,900,901
%N A240400 Numbers n having a partition into distinct parts of form 3^k-2^k.
%C A240400 Numbers n such that there are partitions into distinct parts from A001047. - _Joerg Arndt_, Apr 06 2014
%C A240400 Based on casting binary numbers as ternary numbers. - _Jon Perry_, Apr 12 2014
%H A240400 Reinhard Zumkeller, <a href="/A240400/b240400.txt">Table of n, a(n) for n = 1..1000</a>
%F A240400 A241759(a(n)) > 0. - _Reinhard Zumkeller_, Apr 28 2014
%F A240400 Recursive formula: For n >= 1, a(1)=1 then a(n) = n + 3*a(floor(n/2)). Sum: a(n) = Sum_{k=0..floor(log_2(n))} 3^k*floor(n/2^k). - _Benoit Cloitre_, Apr 06 2019
%e A240400 25 = 19 + 5 + 1 so 25 is in the sequence.
%t A240400 max = 1000; nmax = FindRoot[3^n - 2^n == max, {n, 1}][[1, 2]] // Ceiling; partitions = Select[Table[{3^n - 2^n}, {n, 1, nmax}], (First[#] <= max)&] //. {a___, b_List, c___, d_List, e___} /; Total[b] + Total[d] <= max && FreeQ[p = {a, b, c, d, e}, (j = Join[b, d] // Sort)] && j == Union[j] :> Union[Append[p, j]]; Join[{0}, Total /@ partitions // Sort] (* _Jean-François Alcover_, Apr 16 2014 *)
%o A240400 (JavaScript)
%o A240400 function trimArray(arr) {
%o A240400 var c, i, j;
%o A240400 c = new Array();
%o A240400 for (j = 0; j < arr.length; j++) c[j] = arr[j];
%o A240400 c.sort(function(a, b) {return a - b;});
%o A240400 i = -1;
%o A240400 while(i++ < c.length - 1)
%o A240400 if (c[i] == c[i + 1]) c.splice(i--, 1);
%o A240400 return c;
%o A240400 }
%o A240400 a = new Array();
%o A240400 for (i = 0; i < 10; i++)
%o A240400 a[i] = Math.pow(3, i) - Math.pow(2, i);
%o A240400 b = new Array();
%o A240400 bc = 0;
%o A240400 for (j = 0; j < 130; j++) {
%o A240400 c = 0;
%o A240400 s = j.toString(2);
%o A240400 sl = s.length;
%o A240400 for (k = 0; k < sl; k++) if (s.charAt(k) == 1) c += a[k];
%o A240400 b[bc++] = c;
%o A240400 }
%o A240400 b = trimArray(b);
%o A240400 document.write(b);
%o A240400 (Haskell)
%o A240400 a240400 n = a240400_list !! (n-1)
%o A240400 a240400_list = filter ((> 0) . a241759) [0..]
%o A240400 -- _Reinhard Zumkeller_, Apr 28 2014
%o A240400 (PARI)
%o A240400 a(n)=if(n<2,n%2,n+3*a(floor(n/2)))
%Y A240400 Cf. A241783 (complement).
%Y A240400 Cf. A001047, A005187, A080277, A241759.
%K A240400 nonn
%O A240400 1,3
%A A240400 _Jon Perry_, Apr 04 2014