[Q1]

1)

.1000...0 x 2^2 = 2
.1000...1 x 2^2

Matlab: eps(single(2))

(1/2 + 1/2^24)2^2//N
2.+1/2^22

2)
.100000000 x 2^4 = 8
.11...1 x 2^3

Sum[1/2^i,{i,1,24}] 8.
8.-1/2^21

3)
1/32 = .100000 x 2^p
1/64 = .100000 x 2^(p+1)
2^(24-1)+1

2^23+1

4)
65536 = .1 x 2^17

Matlab: eps(single(65536))

2^16

.10000000001 x 2^17

(1/2 + 1/2^24) 2.^17
1./2^7

.1111111111111 x 2^128   + 1-> WRONG

5)
.100 x 2^1 = 1
.100 x 2^2 = 2
.110 x 2^2 = 3 = 2+1 
.100 x 2^3 = 4
.101 x 2^3 = 5 = 4+1
.110 x 2^3 = 6 = 4+2
.111 x 2^3 = 7 = 4+2+1
.100 x 2^4 = 8
.101 x 2^4 = 10 = 8+4+2

Matlab: single(1/2 * 2^25 +1)

1/2 2^25 +1
2^24+1

[Q2]

1)
._ _ _ x 3^e   -2 <= e <= 3

.1 x 3^2 = 3
.2 x 3^2 = 6
.11 x 3^2 = 3+1 = 4
.101 x 3^2 = 3 + 1/3 = 3.333333
Pi = .1 x 3^2

Abs[Pi-3.]/Pi
Abs[Pi-3.]

2)
.222 x 3^3 = 18 + 6 + 2 = 26

3)
27, 28, 29, 30, 31

Var. 1

A[n_]:=Table[(Subscript["a", i,j]),{i,n},{j,n}] ;
f[n_]:=Table[(Subscript["f", j]),{j,n}];

var1[A_,f_]:=MapThread[Map[#1,#2]&,{f,A}]

n=5;
var1[A[n],f[n]]//MatrixForm

MapThread[g,{f[4],A[4]}]//MatrixForm

MapThread[Map,{f[4],A[4]}]//MatrixForm

Var. 2

var2[A_,f_]:=Transpose[var1[A,f]]

n=5;
var2[A[n],f[n]]//MatrixForm

Misc. 1

{a,b,c}={.4,1.,1.};
{x0,y0}={.2,.4};
n=10000;

ListPlot[
NestList[
{#[[2]]-Sign[#[[1]]] Sqrt[Abs[b #[[1]] - c]], a-#[[1]]}&,
{x0,y0},
n
],
Axes->False,
AspectRatio->Automatic
]

Clear[a,b,c];
makePic[{a_,b_,c_},{x0_,y0_},n_]:=
Graphics[{
PointSize[.004],
Point/@
NestList[
{#[[2]]-Sign[#[[1]]] Sqrt[Abs[b #[[1]] - c]], a-#[[1]]}&,
{x0,y0},
n
]
}
]

makePic[{.4,1.,1.},{.2,.4},10000]//Timing

myf[a_,b_,c_,x0_,y0_]:=
{y0-Sign[x0] Sqrt[Abs[b x0 - c]], a-x0};

makePic2[{a_,b_,c_},{x0_,y0_},n_]:=
Graphics[{
PointSize[.004],
Point/@
NestList[myf[a,b,c,#[[1]],#[[2]]]&,
{x0,y0},
n
]
}
]

makePic2[{.4,1.,1.},{.2,.4},10000]//Timing

Misc. 2

N[π,11]

RealDigits[N[π,10^3+1]][[1]]

(digs=Drop[First[RealDigits[N[π,10^3+1]]],-1])//Length

Count[digs,7]

1/1000. Count[First[RealDigits[N[π,10^3+1]]],#]&/@Range[0,9]

(t=
Prepend[
Table[
1/(10.^i) 
Count[Drop[First[RealDigits[N[π,10^i+1]]],-1],#]&/@Range[0,9],
{i,3,5}],
Range[0,9]
]//Transpose
)//TableForm

Map[Plus@@#&,t\[Transpose]//Rest]

Sequence

replacement rules

inDigits=IntegerDigits[98789777777777777]

pairs=inDigits/.a_Integer->{1,a}

counts=
Block[{l,c,r,a,n,m},
pairs//.
{l___,{n_,a_},c___,{m_,a_},r___}->{l,{n+m,a},c,r}
]

sorted=
Block[{l,e1,u,e2,v,r},
counts//.
{l___,e1:{_,u_},e2:{_,v_},r___}/;v<u->{l,e2,e1,r}
]

outDigits=
Block[{l,a,b,r},
sorted//.
{l___,{a_,b_},r___}->{l,a,b,r}
]

out=
Block[{l,n,r},
outDigits//.
{l___,n_,r___}/;n>9->{l,Quotient[n,10],Mod[n,10],r}
]

iterRule[x_]:=
Block[{a,b,c,l,n,m,r,e1,e2,u,v},
x/.a_Integer->{1,a}//.
{l___,{n_,a_},c___,{m_,a_},r___}->{l,{n+m,a},c,r}//.
{l___,e1:{_,u_},e2:{_,v_},r___}/;v<u->{l,e2,e1,r}//.
{l___,{a_,b_},r___}->{l,a,b,r}//.
{l___,n_,r___}/;n>9->{l,Quotient[n,10],Mod[n,10],r}
]

iterRule[{4,2}]

Sn=42;

Sn=98789777777777777;

FromDigits/@FixedPointList[iterRule,IntegerDigits@Sn,50]

functions

inDigits=IntegerDigits[98789777777777777]

in2=Tally[inDigits]

in3=Sort[in2]

in4=Reverse/@ in3

in5=IntegerDigits/@in4

out=Flatten[in5]

Clear[iterRule]

iterRule[S_]:=
Flatten[IntegerDigits/@Reverse/@Sort[Tally[S]]]

iterRule[{4,2}]

Sn=123;

FromDigits/@FixedPointList[iterRule,IntegerDigits@Sn,50]