DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Java
  4. Java Holiday Calendar 2016 (Day 24): How Many Santas Are There, Really?

Java Holiday Calendar 2016 (Day 24): How Many Santas Are There, Really?

Yes, Virginia, there really is a Santa Claus. In fact, there might be a lot of them. Let's do some Java math to see how many Santas it takes to deliver presents around the world.

Per-Åke Minborg user avatar by
Per-Åke Minborg
·
Dec. 24, 16 · Tutorial
Like (6)
Save
Tweet
Share
8.67K Views

Join the DZone community and get the full member experience.

Join For Free

Image title


Today, we are going to do some nonsense calculations. Is there a Santa, and if yes, how many Santas can we expect to find in the world?

The Assumptions

Let us start with some assumptions. When this article was written, there was an estimate of 7,472,085,518 humans on Earth. Let us disregard the guys who live on the International Space Station, because presumably, Santa's reindeer cannot operate in near-Earth orbit. Luckily for those guys, Elon Musk can deliver their presents via Space X's delivery rocket instead.

A large number of the remaining people are not visited by Santa at all, including people of various religious affiliations or beliefs and people who are very poor. We assume that only one-third of the remaining persons are visited. We further assume that, on average, there are three persons per household (this is not unreasonable, taking the vast number of single-person-households into account). Furthermore, we assume that each person gets four presents on average (some rich ones get much more, some poor just get one, if they are lucky).

Additionally, we estimate that there is an average distance of 500 m (i.e. 0.5 km or 0.3 miles) between each household and that Santa's average sleigh speed is 4 m/s (i.e. 14 km/h or 9 mph) and that it takes Santa 1 second to drop of each present. It should be noted that the actual procedure of handing over presents differs from country to country. In the US, Santa is more likely to drop the packages down the chimney and curve the packages so that they always backspin and land in socks that are hung up near the fireplace, whereas in some European countries, he is more likely to deliver the packages in person. This is not covered in the model, though.

Because the speed of the sleigh is not extreme, Santa cannot take advantage of the fact that the Earth is rotating and that there different time zones. So, Santa can only work 24 hours.

The Java Code 

In Java, we can model the problem like this:

public class NumberOfSantas {

    private static final long NUMBER_OF_PERSONS = 7_472_085_518L / 3;
    private static final int PERSONS_PER_HOUSHOLD = 3;
    private static final long NUMBER_OF_HOUSHOLDS = NUMBER_OF_PERSONS / PERSONS_PER_HOUSHOLD;
    private static final int PRESENTS_PER_PERSON = 4;

    private static final int AVERAGE_DISTANCE_BETWEEN_HOUSHOLDS = 500; // m (i.e. 0.5 km or 0.3 miles)
    private static final int AVERAGE_SLEIGH_SPEED = 4; // 4 m/s (i.e. 14 km/h or 9 mph)
    private static final int TIME_TO_DELIVER_PRESENTS = 1; // 1 s 

    private static final int WORKING_HOURS = 24;

    public static void main(String[] args) {
        long totalTimeS = NUMBER_OF_HOUSHOLDS
            * (AVERAGE_DISTANCE_BETWEEN_HOUSHOLDS / AVERAGE_SLEIGH_SPEED)
            + TIME_TO_DELIVER_PRESENTS * NUMBER_OF_PERSONS * PRESENTS_PER_PERSON;

        long noSantas = totalTimeS / (WORKING_HOURS * 3600);

        System.out.format("There are %,d Santas in the world", noSantas);
    }
}


Evidently, there is a large number of Santas out there because the program above outputs the following:

There are 1,316,455 Santas in the world

(Ho, ho)^1.3 M...

Follow the Java Holiday Calendar 2016 with small tips and tricks all the way through the winter holiday season.

Java (programming language) Calendar (Apple)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How To Check Docker Images for Vulnerabilities
  • Fraud Detection With Apache Kafka, KSQL, and Apache Flink
  • How Observability Is Redefining Developer Roles
  • Upgrade Guide To Spring Data Elasticsearch 5.0

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: