login
Replace each digit of n with the floor of its square root.
5

%I #36 Oct 19 2024 13:52:15

%S 0,1,1,1,2,2,2,2,2,3,10,11,11,11,12,12,12,12,12,13,10,11,11,11,12,12,

%T 12,12,12,13,10,11,11,11,12,12,12,12,12,13,20,21,21,21,22,22,22,22,22,

%U 23,20,21,21,21,22,22,22,22,22,23,20,21,21,21,22,22,22,22,22,23

%N Replace each digit of n with the floor of its square root.

%C The graph of this sequence is fractal-like.

%C a(A007088(n))=A007088(n); a(A136399(n))<>A136399(n); a(a(n))=A136400(n); a(A136400(n))=A136400(n); A136428(n)=a(n+1)-a(n). - _Reinhard Zumkeller_, Dec 30 2007

%H Reinhard Zumkeller, <a href="/A064770/b064770.txt">Table of n, a(n) for n = 0..9999</a>

%H Olivier Gerard, <a href="http://list.seqfan.eu/seqfandata/A064770-spadaro.png">Fractal behavior of this sequence (1)</a>. [broken link]

%e 26 -> [1.414...][2.449...] -> 12, so a(26) = 12.

%p a:= n-> (l-> add(([0, 1$3, 2$5, 3][l[i]+1])*10^i,

%p i=1..nops(l))/10)(convert(n, base, 10)):

%p seq(a(n), n=0..69); # _Alois P. Heinz_, Oct 19 2024

%t Table[ FromDigits[ Floor[ Sqrt[ IntegerDigits[ n]]]], {n, 0, 100} ]

%t With[{dg=Table[n->Floor[Sqrt[n]],{n,0,9}]},Table[FromDigits[ IntegerDigits[ k]/.dg],{k,0,100}]] (* _Harvey P. Dale_, Oct 23 2020 *)

%o (Haskell)

%o import Data.Char (digitToInt)

%o a064770 :: Integer -> Integer

%o a064770 = read . map (("0111222223" !!) . digitToInt) . show

%o -- _Reinhard Zumkeller_, Aug 24 2011

%o (PARI) a(n) = fromdigits(apply(sqrtint, digits(n))); \\ _Michel Marcus_, Nov 12 2023

%o (Python)

%o def A064770(n): return int(''.join(map(lambda x:'0111222223'[int(x)], str(n)))) # _Chai Wah Wu_, Oct 19 2024

%Y Cf. A007088, A136399, A136400, A136428.

%K base,nonn,nice,look

%O 0,5

%A _Santi Spadaro_, Oct 19 2001