login
n written in base where place values are positive squares.
13

%I #15 Jul 25 2015 15:52:48

%S 1,2,3,10,11,12,13,20,100,101,102,103,110,111,112,1000,1001,1002,1003,

%T 1010,1011,1012,1013,1020,10000,10001,10002,10003,10010,10011,10012,

%U 10013,10020,10100,10101,100000,100001,100002,100003,100010,100011

%N n written in base where place values are positive squares.

%C For n>1: A000196(n) = number of digits of a(n); A190321(n) = number of nonzero digits of a(n); A053610(n) = sum of digits of a(n). [_Reinhard Zumkeller_, May 08 2011]

%H Reinhard Zumkeller, <a href="/A007961/b007961.txt">Table of n, a(n) for n = 1..10000</a>

%H F. Smarandache, <a href="http://www.gallup.unm.edu/~smarandache/OPNS.pdf">Only Problems, Not Solutions!</a>.

%p A007961 := proc(n)

%p local k,nrem,L,b,d;

%p k := floor(sqrt(n)) ;

%p nrem := n ;

%p L := [] ;

%p for b from k to 1 by -1 do

%p d := floor(nrem/b^2) ;

%p L := [d,op(L)] ;

%p nrem := nrem -d*b^2 ;

%p end do:

%p add( op(i,L)*10^(i-1),i=1..nops(L)) ;

%p end proc: # _R. J. Mathar_, Jul 25 2015

%o (Haskell)

%o import Data.Char (intToDigit)

%o a007961 :: Integer -> Integer

%o a007961 n = read $ map intToDigit $

%o t n $ reverse $ takeWhile (<= n) $ tail a000290_list where

%o t _ [] = []

%o t m (x:xs)

%o | x > m = 0 : t m xs

%o | otherwise = (fromInteger m') : t r xs

%o where (m',r) = divMod m x

%o -- _Reinhard Zumkeller_, May 08 2011

%Y Cf. A000290, A000433.

%K nonn,base

%O 1,2

%A R. Muller