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.
%I A328481 #18 Oct 19 2019 21:26:31 %S A328481 0,1,1,2,2,3,1,2,2,3,3,4,1,2,2,3,3,4,2,3,3,4,4,5,2,3,3,4,4,5,1,2,2,3, %T A328481 3,4,2,3,3,4,4,5,2,3,3,4,4,5,3,4,4,5,5,6,3,4,4,5,5,6,1,2,2,3,3,4,2,3, %U A328481 3,4,4,5,2,3,3,4,4,5,3,4,4,5,5,6,3,4,4,5,5,6,2,3,3,4,4,5,3,4,4,5,5,6,3,4,4,5 %N A328481 Number of terms required when n is expressed as a greedy sum of terms of A129912 (digital sum of n when written in greedy A129912-base). %H A328481 Antti Karttunen, <a href="/A328481/b328481.txt">Table of n, a(n) for n = 0..30030</a> %H A328481 <a href="/index/Pri#primorial_numbers">Index entries for sequences related to primorial numbers</a> %F A328481 a(0) = 0; and for n > 0, a(n) = 1 + a(A328480(n)). %F A328481 a(A129912(n)) = a(A002110(n)) = 1. %F A328481 For all n, a(n) >= A328482(n). %e A328481 Terms of A129912 (numbers that are products of distinct primorial numbers) begin as: 1, 2, 6, 12, 30, 60, 180, 210, 360, 420, 1260, ... %e A328481 Number 5 is expressed as 5 = 2 + 2 + 1 when always choosing the largest term which is <= {what is remaining of the original number}. Thus a(5) = 3. %e A328481 Number 21 is expressed as 21 = 12 + 6 + 2 + 1, thus a(21) = 4. %e A328481 Number 720 is expressed as 720 = 420 + 210 + 60 + 30, thus a(720) = 4. Note that 720 = 2*360, so in this case the greedy algorithm does not produce an optimal result. %o A328481 (PARI) %o A328481 isA129912(n) = { my(o=valuation(n, 2), t); if(o<1||n<2, return(n==1)); n>>=o; forprime(p=3, , t=valuation(n, p); n/=p^t; if(t>o || t<o-1, return(0)); if(t==0, return(n==1)); o=t); }; \\ From A129912 %o A328481 prepare_A129912_upto(n) = { my(xs=List([]), k=0); while(k<n, k++; if(isA129912(k), listput(xs,k))); List(Vecrev(xs)); }; %o A328481 number_of_terms_in_greedy_sum(n,terms) = { my(c=0); while(n,if(terms[1] > n, listpop(terms,1), c += (n\terms[1]); n %= terms[1])); (c); }; %o A328481 number_of_terms_in_greedy_sum_v1(n,terms) = { my(c=0); while(n,if(terms[1] > n, listpop(terms,1), n -= terms[1]; c++)); (c); }; \\ (Simpler variant) %o A328481 A328481(n) = number_of_terms_in_greedy_sum(n,prepare_A129912_upto(n)); %Y A328481 Cf. A002110, A129912, A328480, A328482, A328483. %Y A328481 Cf. also A276150. %K A328481 nonn %O A328481 0,4 %A A328481 _Antti Karttunen_, Oct 19 2019