%I #18 Dec 06 2023 21:17:33
%S 1,60,81,340,7060
%N Numbers k such that the digits of sigma_2(k) end in k.
%C Recall that sigma_2(k) denotes the sum of the squares of the divisors of k.
%C No more terms between 7060 and 420000. - _R. J. Mathar_, May 30 2010
%C No additional terms up to 10 million. - _Harvey P. Dale_, Dec 09 2014
%C No additional terms < 3*10^9. - _Sean A. Irvine_, Dec 06 2023
%e The divisors of 81 are 1,3,9,27,81, the sum of whose squares = 7381 which ends in 81, so 81 is a term of the sequence.
%p endswith := proc(a,b) local dgsa,dgsb,ndb ; dgsa := convert(a,base,10) ; dgsb := convert(b,base,10) ; if nops(dgsa) >= nops(dgsb) then ndb := nops(dgsb) ; [op(1..ndb,dgsa)] = dgsb ; else false; end if; end proc:
%p for i from 1 do if endswith(numtheory[sigma][2](i),i) then printf("%d,\n",i) ; end if; end do: # _R. J. Mathar_, May 30 2010
%t (*returns true if a ends in b, false o.w.*) f[a_, b_] := Module[{c, d, e, g, h, i, r}, r = False; c = ToString[a]; d = ToString[b]; e = StringLength[c]; g = StringPosition[c, d]; h = Length[g]; If[h > 0, i = g[[h]]; If[i[[2]] == e, r = True]]; r]; Select[Range[10^5], f[Divisor[2, # ], # ]] &]
%t Select[Range[10000],Mod[DivisorSigma[2,#],10^IntegerLength[#]]==#&] (* _Harvey P. Dale_, Dec 09 2014 *)
%K base,nonn
%O 1,2
%A _Joseph L. Pe_, Feb 19 2002