> < ^ Date: Sun, 22 Apr 2001 16:17:26 +0400 (MSD)
< ^ From: Anatol V. Rukolaine <rukolaha@tower.hop.stu.neva.ru >
^ Subject: In response to message of Markus Pueschel.

Dear Markus Pueschel and GAP-Forum,

Markus wrote (20.04.2001):
> I have the following problem (GAP3). When printing a
> long string to a file using the function PrintTo, the
> string is broken at a certain length and a "\" is inserted.
> . . .
> How can I avoid the line-breaking or at least the insertion of
> backslashes?

It's possible that there are non-documented functions in GAP
for solving your problems. But creators of GAP don't recommend to use
such function.

Perhaps that a next function will help to you. Of course, this function
is only for output on the screen and use the function Print. I can modify
to use the function PrintTo.

#_____________________________
Print_LongInt:=function(N,Q)
   #!!! Only for POSITIVE INTEGERs.
   local
      Cnt,Power_10,NN,Next_Figure;
   if (N > 0) and IsInt(N)
              and (Q > 0) and IsInt(Q) then
      Power_10:=1;
      # Power_10 - power of 10.
      while Power_10 <= N do
         Power_10:=Power_10 * 10;
      od;
      # Now Power_10 >= N.
NN:=N;
if Power_10 <> N then
   Power_10:=Power_10/10;
fi;
Cnt:=0; # Cnt - counter.
while Power_10 >= 1 do
   Cnt:=Cnt+1;
   Next_Figure:=Int(NN/Power_10);
   Print(Next_Figure);
   if Cnt = Q then
      Print("\n");
      Cnt:=0;
   fi;
   NN:=NN - Next_Figure*Power_10;
   Power_10:=Power_10 /10;
od;
Print("\n");
   else
      Print("\n\n!!!\n Be gone! I don't want.\n\n");
   fi;
   end;
#______________


For example:
gap> Print_LongInt(Factorial(150),78);
571338395644585459047893286526105400318955357860112641825483758331798291248453
983931265744886753111453771078787468542041626662501986845044663559491959220665
749425920957357789293253572904449624724054167907221184454371222696755200000000
00000000000000000000000000000

For comparision:
gap> Print(Factorial(150));
571338395644585459047893286526105400318955357860112641825483758331798291248453\
983931265744886753111453771078787468542041626662501986845044663559491959220665\
749425920957357789293253572904449624724054167907221184454371222696755200000000\
00000000000000000000000000000

Best regards,
Anatolii^ V. Rukolaine (Russia, S.-Petersburg).


> < [top]