A064459 a(n) = Sum_{k>=1} floor(n/12^k).
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8
Offset: 0
Links
- Harry J. Smith, Table of n, a(n) for n=0..1000
- Wikipedia, Legendre's formula.
Programs
-
GAP
List([0..110],n->Sum([1..n],k-?Int(n/(12^k)))); # Muniru A Asiru, Mar 24 2018
-
Maple
f:= proc(n) add(floor(n/12^k), k=1..floor(log[12](n))) end proc: f(0):= 0: map(f, [$0..100]); # Robert Israel, Mar 23 2018
-
Mathematica
Table[t = 0; p = 12; While[s = Floor[n/p]; t = t + s; s > 0, p *= 12]; t, {n, 0, 100} ] Join[{0},Accumulate[Table[If[Divisible[n,12],1,0],{n,110}]]] (* Harvey P. Dale, Feb 14 2016 *)
-
PARI
{ for (n=0, 1000, a=0; p=12; while (s = n\p, a+=s; p*=12); write("b064459.txt", n, " ", a) ) } \\ Harry J. Smith, Sep 15 2009
Formula
a(n) = floor[n/12] + floor[n/144] + floor[n/1728] + floor[n/20736] + ....
Extensions
Corrected by Robert Israel, Mar 23 2018
Comments