Recent

Author Topic: 21237.0 as TDateTime  (Read 699 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 14367
  • Sensorship about opinions does not belong here.
21237.0 as TDateTime
« on: February 21, 2024, 07:54:26 am »
Since the above TDateTime value is today exactly many moons ago (66) I treated myself on a little teaser, after the coffee that is:
Code: Pascal  [Select][+][-]
  1. program BirthdayParadox;
  2. {$mode objfpc}
  3. uses
  4.   sysutils,math;
  5.  
  6. function CalculatePeopleForProbability(p: Double): Integer;
  7. begin
  8.   // Approximate the number of people needed for a given probability
  9.   Result := Ceil(Sqrt(2 * 365 * Ln(1 / (1 - p))));
  10. end;
  11.  
  12. begin
  13.   // Calculate the number of people needed for a 50% probability
  14.   // that two people share the same birthday
  15.   WriteLn('Number of forum members needed for a 50% probability: ', CalculatePeopleForProbability(0.5));
  16.   writeln(DateTimeToStr(21237.0));
  17. end.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

paweld

  • Hero Member
  • *****
  • Posts: 995
Re: 21237.0 as TDateTime
« Reply #1 on: February 21, 2024, 09:02:14 am »
@Thaddy: Happy birthday. Sto lat!
« Last Edit: February 21, 2024, 08:09:08 pm by paweld »
Best regards / Pozdrawiam
paweld

cdbc

  • Hero Member
  • *****
  • Posts: 1078
    • http://www.cdbc.dk
Re: 21237.0 as TDateTime
« Reply #2 on: February 21, 2024, 09:06:20 am »
Hi
A very happy birthday to you Thaddy  :)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

TRon

  • Hero Member
  • *****
  • Posts: 2506
Re: 21237.0 as TDateTime
« Reply #3 on: February 21, 2024, 07:40:05 pm »
Happy birthday Thaddy and enjoy !

 

TinyPortal © 2005-2018