%I #9 Jul 12 2013 05:58:01
%S 0,1,4,9,7,7,9,4,1,9,100,121,144,169,187,117,139,154,171,199,400,441,
%T 484,439,477,427,469,414,451,499,900,961,934,999,967,937,999,964,931,
%U 999,700,781,774,769,757,747,739,724,711,799,700,711,724,739,747,757
%N a(n) = n*n in carryless digital root arithmetic in base 10.
%C Addition and multiplication are the same as in school, that is, done in base 10, except that there are no carries and when individual digits are added or multiplied the result is replaced by its digital root (A010888).
%H <a href="/index/Ca#CARRYLESS">Index entries for sequences related to carryless arithmetic</a>
%e 14*14 = 187:
%e ..14
%e ..14
%e ----
%e ..47
%e .14.
%e ----
%e .187
%e ----
%p A010888 := proc(n)
%p if n = 0 then
%p 0;
%p else
%p 1+modp(n-1,9) ;
%p end if;
%p end proc:
%p carryLmult1dig := proc(a,b)
%p local adigs,cdigs,d,len ;
%p if b <= 9 then
%p adigs := convert(a,base,10) ;
%p len := nops(adigs) ;
%p cdigs := [seq( A010888(b*op(d,adigs)) ,d=1..len)] ;
%p add(op(d,cdigs)*10^(d-1),d=1..len) ;
%p else
%p error b,"not smaller than 10" ;
%p end if;
%p end proc:
%p carryLmult := proc(a,b)
%p local adigs,bdigs,c,len ;
%p adigs := convert(a,base,10) ;
%p bdigs := convert(b,base,10) ;
%p len := max(nops(adigs),nops(bdigs)) ;
%p c := 0 ;
%p for i from 1 to nops(bdigs) do
%p carryLmult1dig(a,op(i,bdigs)) ;
%p c := carryLadd(c,%*10^(i-1)) ;
%p end do:
%p c ;
%p end proc:
%p A169908 := proc(n)
%p carryLmult(n,n) ;
%p end proc: # _R. J. Mathar_, Jul 12 2013
%Y Cf. A010888, A169821.
%K nonn,base
%O 0,3
%A _David Applegate_, _Marc LeBrun_ and _N. J. A. Sloane_, Jul 11 2010
|