[SeqFan] Lucky numbers sequences.

Patrick De Geest Patrick.DeGeest at ping.be
Mon Mar 23 01:32:21 CET 1998


> [Olivier's remark: to avoid duplicating effort on this easy topic
> you can for instance announce to the list which ones you are going
> to compute.]

Just finished submitting the following luckies sequences to Sloane :

%N Numbers both lucky and prime.
%N Twin lucky numbers (lower terms).
%N Twin lucky numbers (upper terms).
%N Twin lucky numbers (middle terms).
%N Palindromic lucky numbers.
%N Numbers both lucky and square.
%N Square root of square lucky numbers.

The last sequence fills only two lines. This is due to 'array size
overflow' in my UBASIC program. I'll try other programming languages
to circumvent this DIM limitation to max 65534 in lines 80/90.

Here is the UBASIC program I concocted :
Amendments and improvements always welcome.

   10   'Lucky numbers
   20   '
   30   'Programmed by Patrick De Geest - march 22,1998.
   40   color 15:cls
   50   Ti$="Numbers both square and lucky."
   60   print Ti$:print:lprint Ti$:lprint
   70   print "m = 1":lprint tab(10);"m = 1"
   80   Top=65534
   90   dim L%(Top):M=1
  100   'mark even numbers 2,4,6,8,...
  110   for X=0 to Top step 2
  120   L%(X)=1
  130   next X
  140   '
  150   loop
  160   'find in array first numbervalue 0 starting from 'mark' M
  170   for X=M+1 to Top
  180   if L%(X)=0 then M=X:cancel for:goto 210
  190   next X
  200   'mark multiples of M into array L
  210   X=1:K%=0
  220   repeat
  230   if L%(X)=0 then inc K%
  240   if K%=M then L%(X)=1:K%=0
  250   inc X
  260   until X>Top
  270   if M+K%>Top then end
  280   if isqrt(M)<>sqrt(M) then 300
  290   beep:print "m =";M,isqrt(M):lprint tab(10);"m =";M,isqrt(M)
  300   endloop


- -- 
Patrick De Geest
[mailto:Patrick.DeGeest at ping.be]
- ---------------------------------------------------
URL : http://www.ping.be/~ping6758/index.shtml
- ---------------------------------------------------






More information about the SeqFan mailing list