My Math Forum  

Go Back   My Math Forum > College Math Forum > Real Analysis

Real Analysis Real Analysis Math Forum


Reply
 
LinkBack Thread Tools Display Modes
February 12th, 2013, 05:17 PM   #1
Newbie
 
Joined: Feb 2013

Posts: 1
Thanks: 0

Translating Algorithm into Math?

Hello. This is my first posting here, so I am not sure this is in the correct place.

I have this math problem:
Find the number of distinct integers in this set:

[ (1^2) / 5012 ] , [ (2^2) / 5012 ] , ...... , [ (5012^2) / 5012 ]

where [ x ] denotes the greatest integer less than or equal to x.

I am not very familiar with the mathematical notation involved with this problem, so I wrote a computer program that solves it (in Java):
Code:
double t[] = new double[5013];
        Set<Integer> distinct = new HashSet<Integer>();
        
        for (int i = 1; i <= 5012; i++) {
            double q = Math.pow(i, 2);
            int l = (int) Math.floor(q / 5012); //gets "X" (greatest integer <= x)
            
            t[i] = l;            
            distinct.add(l);           
            
        }
        System.out.println(distinct);
        System.out.println("SIZE: " + distinct.size());
I get the correct answer: 3760, and I get the entire set of distinct integers.
But I do not know how to represent this mathematically. Any help is appreciated!
Thank you.
flyjoe is offline  
 
Reply

  My Math Forum > College Math Forum > Real Analysis

Tags
algorithm, math, translating



Search tags for this page
Click on a term to search for related topics.
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Math: Algorithm to Solve an Optimal Set forkconfig Applied Math 1 February 6th, 2014 02:25 PM
translating a circle yogazen2013 Algebra 4 October 7th, 2013 06:53 AM
Math algorithm najken Computer Science 3 September 1st, 2012 02:30 PM
Translating Equations IDoNotLikeMath Algebra 7 June 19th, 2012 07:19 PM
translating a circle yogazen2013 Calculus 0 December 31st, 1969 04:00 PM





Copyright © 2019 My Math Forum. All rights reserved.