** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ***

TO PLOT THE CANTOR FUNCTION:

thepoints={{0,0},{1,1}};
levels=8;
Do[number=(n/(3^levels));nterms=25;a=Table[0,{i,1,25}];leftover=Table[0,{i,1,25}];a[[1]]=Floor[3 number];leftover[[1]]=number-((a[[1]])/3);Do[a[[k]]=Floor[(3^k) leftover[[k-1]]];leftover[[k]]=leftover[[k-1]]-((a[[k]])/(3^k)),{k,2,nterms}];nlast=nterms;Do[If[a[[nterms+1-k]]==1,nlast=nterms+1-k],{k,1,nterms}];fun[number]=N[(∑_(k=1)^(nlast-1))((a[[k]])/(2 (2^k)))+(1/(2^nlast))];thepoints=Append[thepoints,{number,fun[number]}],{n,1,(3^levels)-1}];
fred=thepoints[[Ordering[thepoints]]];
cantorgraph=ListPlot[fred,Joined->True]

numberofzooms=1;
Print["The CANTOR FUNCTION"];
Do[xticks={0,{(1/3),((((1/3)))^k)},{(2/3),2 ((((1/3)))^k)},{1,3 ((((1/3)))^k)}};yticks={0,{(1/2),((((1/2)))^k)},{1,2 ((((1/2)))^k)}};Print[Show[cantorgraph,Ticks->{xticks,yticks}]];Print[" "];Print["  "];If[k≠numberofzooms,Print[" Zooming in on the origin: "]],{k,1,numberofzooms}];

numberofzooms=2;
Print["The CANTOR FUNCTION"];
Do[xticks={0,{(1/3),((((1/3)))^k)},{(2/3),2 ((((1/3)))^k)},{1,3 ((((1/3)))^k)}};yticks={0,{(1/2),((((1/2)))^k)},{1,2 ((((1/2)))^k)}};Print[Show[cantorgraph,Ticks->{xticks,yticks},AspectRatio->((((3/2)))^(k-1))]];Print[" "];Print["  "];If[k≠numberofzooms,Print[" Zooming in on the origin: "]],{k,1,numberofzooms}];