OFFSET
1,4
COMMENTS
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
P. Erdős, T. Motzkin, Problem 5735, Amer. Math. Monthly, 78 (1971), 680-681. (Incorrect solution!)
H. N. Shapiro, Problem 5735, Amer. Math. Monthly, 97 (1990), 937.
FORMULA
MAPLE
N:= 100: # to get a(1)..a(N)
V:= Vector(N):
V[1]:= 1:
for n from 2 to N do
if V[n] = 0 then
S:= {n};
for p in numtheory:-factorset(n) do
S := S union {seq(seq(s*p^k, k=1..floor(log[p](N/s))), s=S)};
od:
S:= sort(convert(S, list));
for k from 1 to nops(S) do V[S[k]]:= k od:
fi
od:
convert(V, list); # _Robert Israel_, May 20 2016
MATHEMATICA
PkTbl=Prepend[ Array[ Times @@ First[ Transpose[ FactorInteger[ # ] ] ]&, 100, 2 ], 1 ]; 1+Array[ Count[ Take[ PkTbl, #-1 ], PkTbl[ [ # ] ] ]&, Length[ PkTbl ] ]
Count[#, k_ /; k == Last@ #] & /@ Function[s, Take[s, #] & /@ Range@ Length@ s]@ Array[Map[First, FactorInteger@ #] &, 120] (* or *)
Table[Sum[(Floor[n^k/k] - Floor[(n^k - 1)/k]) (Floor[k^n/n] - Floor[(k^n - 1)/n]), {k, n}], {n, 120}] (* _Michael De Vlieger_, May 20 2016 *)
PROG
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
_Jeffrey Shallit_, _Olivier Gérard_
STATUS
approved