Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Re: Capture prime number between a range

Featured Replies

Hi there, just want to know how to capture all the prime number between a range and then store the result into a field.

Regards,

Henry

Hi Henry,

How about a few examples of the text/field data that contains "prime number between a range" so we can see the patterns involved.

Lee

UPDATED ATTACHMENT

Here is one solution that uses the Sieve of Eratosthenes to find a solution.

PrimeDirective.zip

  • Author

The example is for the number range 10 to 20 ( the range can define by user), the result will be

11, 13, 17, 19

The end result can store in a text field and seperate each number by a return "

  • Author

Addition information

The range is define with 2 number field, it is define by user, user can key in the range themself. After they key in the two number, they can click a button to capture/calculate out all the prime number between the range.

another example: range :P 20 to 35

the result will be : 23, 29, 31

Regards,

Henry

Here is a solution that provides the output that you wanted:

PrimeDirective.zip

  • Author

I got it, thanks

Regards,

Henry

While the Sieve of Eratosthenes method can be efficient in certain situations such as a very large range, or a small range that starts at a very high number, it is hard to implement a fast version in Filemaker because of the speed of record creation. I think in this case, the old brute force method is actually quicker. See attachment.

FindPrimes.fp5.zip

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.