login
Number of bar segments in a certain way of representing the integers graphically.
1

%I #16 Nov 17 2020 08:55:14

%S 0,1,2,2,3,2,3,3,3,3,4,3,3,4,3,3,4,3,4,4,4,4,4,4,4,5,4,5,4,3,5,4,5,4,

%T 4,4,4,5,5,5,4,4,5,5,4,5,4,4,4,4,6,6,4,4,5,6,5,5,5,4,4,5,5,3,6,5,5,5,

%U 6,4,5,5,5,6,4,6,4,5,5,5,4

%N Number of bar segments in a certain way of representing the integers graphically.

%C Let p(i) = i-th prime. Let n = Product_{i=1..s} p(k_i)^e_i with k_1 < k_2 < ... < k_s. The drawing of n=1 is a blank space. The drawing of n > 1 is arranged around a horizontal bar divided by s-1 scores into s segments. The scores and the bar divide the space above and below the bar into 2's compartments. In the i-th compartment above the bar place the drawing of e_i and in the i-th compartment below the bar place the drawing of k_i - k_{i-1}.

%H Alois P. Heinz, <a href="/A019569/b019569.txt">Table of n, a(n) for n = 1..65536</a>

%H Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a019/A019569.java">Java program</a> (github)

%H Tyler Pierce, <a href="http://ingrate.8k.com/nrep/intro.html">A way of drawing natural numbers</a>

%F a(1) = 0; a(2) = 1; a(n) = s + Sum_{i=1..s} ( a(e_i) + a(k_i - k_{i-1}) ) with k_0 = 0.

%p with(numtheory):

%p a:= proc(n) option remember; `if`(n<3, n-1, (l-> nops(l)+

%p add(a(l[i, 2])+a(pi(l[i, 1])-`if`(i=1, 0, pi(l[i-1, 1]))),

%p i=1..nops(l)))(sort(ifactors(n)[2], (x, y)-> x[1]<y[1])))

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Mar 26 2019

%t a[n_] := a[n] = If[n<3, n-1, Function[l, Length[l] + Sum[a[l[[i, 2]]] + a[PrimePi[l[[i, 1]]] - If[i == 1, 0, PrimePi[l[[i-1, 1]]]]], {i, 1, Length[l]}]][SortBy[FactorInteger[n], First]]];

%t Array[a, 100] (* _Jean-François Alcover_, Nov 17 2020, after _Alois P. Heinz_ *)

%K nonn

%O 1,3

%A _N. J. A. Sloane_, _Simon Plouffe_

%E Formula corrected by _Sean A. Irvine_, Mar 26 2019