Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Welcome to 2023.
#1
Hi,

Happy belated 2023! This is a program to display the factors of 2023:

Code: (Select All)
Year = 2023
z = Year - 1
Do Until z = Year
  z = z + 1
  x = z
  Print x; "=";
  l = 1
  q = 0
  Do Until x = 1
      l = l + 1
      Do While x / l = x \ l ' continue to divide number
        q = q + 1
        If q > 1 Then
            Print "*";
        End If
        Print l;
        x = x / l
      Loop
      If l > Int(z / 2) Then ' test for maximum divisor
        Exit Do
      End If
      If l > Int(Sqr(x)) Then ' test maximum divisor is prime
        If q = 0 Then
            Exit Do
        End If
      End If
  Loop
  If q = 0 Then ' display number is prime
      Print " (prime)";
  End If
  Print
Loop
End
Reply


Messages In This Thread
Welcome to 2023. - by eoredson - 02-08-2023, 03:39 AM
RE: Welcome to 2023. - by PhilOfPerth - 02-08-2023, 05:31 AM
RE: Welcome to 2023. - by bplus - 02-08-2023, 03:32 PM
RE: Welcome to 2023. - by eoredson - 02-08-2023, 05:40 AM
RE: Welcome to 2023. - by PhilOfPerth - 02-08-2023, 09:03 AM
RE: Welcome to 2023. - by PhilOfPerth - 02-08-2023, 11:09 PM



Users browsing this thread: 1 Guest(s)