Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math

Topic: 2506=2*10^3+5*10^2+0*10+6^1*10^0
Replies: 8   Last Post: Oct 30, 2013 1:44 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
scattered

Posts: 90
Registered: 6/21/12
Re: 2506=2*10^3+5*10^2+0*10+6^1*10^0
Posted: Oct 30, 2013 1:09 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Wednesday, October 30, 2013 10:40:55 AM UTC-4, jonas.t...@gmail.com wrote:
> Den tisdagen den 29:e oktober 2013 kl. 21:00:44 UTC+1 skrev Virgil:
>

> > In article <19afd53e-b219-4480-a630-d534b39b5416@googlegroups.com>,
>
> >
>
> > jonas.thornvall@gmail.com wrote:
>
> >
>
> >
>
> >
>
> > > Den tisdagen den 29:e oktober 2013 kl. 20:16:53 UTC+1 skrev
>
> >
>
> > > jonas.t...@gmail.com:
>
> >
>
> > > > 2506=2*10^3+5*10^2+0*10+6^1*10^0
>
> >
>
> > > >
>
> >
>
> > The above is sometimes called a "base 10 expansion" or "decimal
>
> >
>
> > expansion".
>
> >
>
> >
>
> >
>
> > And while there are comparable binary, octal and hexadecimal expansions,
>
> >
>
> > particulatlry in computer technology, the expansions below are of quite
>
> >
>
> > a different type, and have no name that I am aware of.
>
> >
>
> > > >
>
> >
>
> > > > Is there a name for when you write out a number as the right side
>
> >
>
> > > > expression?
>
> >
>
> > >
>
> >
>
> > > If so there must be a name for when you write out expression like.
>
> >
>
> > > Exp=x^2
>
> >
>
> > > 7777777777= 88191 353 26 3 +2 = 88191^2+ 353^2+ 26^2+ 3^2 +2
>
> >
>
> > > Exp=x^3
>
> >
>
> > > 7777777777= 1981 153 33 10 4 3 3 +4=1981^3+ 153^3+ 33^3+ 10^3+ 4^3+ 3^3+ 3^3
>
> >
>
> > > +4
>
> >
>
> > > Exp=x^4
>
> >
>
> > > 7777777777= 296 100 33 12 9 5 4 3 3 2 2 2 +12 =296^4+ 100^4+ 33^4+ 12^4+ 9^4+
>
> >
>
> > > 5^4+ 4^4+ 3^4+ 3^4+ 2^4+ 2^4+ 2^4 +12
>
> >
>
> > >
>
> >
>
> > > Or maybe there simply isn't so what should i call these forms?
>
> >
>
> > --
>
>
>
> I managed to implement it in python also.
>
>
>
> #!/usr/bin/python
>
> import math
>
> # Function definition is here
>
> def sq(number):
>
>
>
> exp=1
>
> factor=2
>
> multip=math.pow(2,exponent)
>
> print(x,"= ", end="")
>
> while number>=multip:
>
> while exp<=number:
>
> factor+=1
>
> exp=math.pow(factor,exponent)
>
> factor-=1
>
> print(factor,"^",exponent,"+",sep="",end="")
>
> exp=math.pow(factor,exponent)
>
> number=number-exp
>
> exp=1
>
> factor=1
>
> print(number)
>
>
>
> #Set exponent here
>
> exponent=2
>
> print("Exp=x^",exponent,sep="")
>
> #Set range of numbers x
>
> for x in range (1,100):
>
> sq(x)


Here is a Python implementation of a fairly
general function which can used to solve this and other, similar problems:

#if f is an increasing function from positive
#integers to positive integers with the
#property that f(1) = 1
#then every integer n can be written as
#a sum of numbers of the form f(k) with k <=n
#the following implements a greedy algorithm to do so

#first, a binary search algorithm
#to find largest k <= n with f(k) <= n

def largest(n,f):
if f(n) <= n: return n
low = 1
high = n #f(low) <= n but f(high) > n
while low + 1 < high:
mid = (low + high) // 2
if f(mid) <= n:
low = mid
else:
high = mid
return low

#as an application,
#we can get an integer square root function
#albeit not the most efficient one

def square(n): return n*n

def isqrt(n):
return largest(n,square)

#now implement a greedy algorithm
#it returns a list of numbers in descending order

def find_terms(n,f):
k = largest(n,f)
terms = [k]
n = n - f(k)
while n > 0:
k = largest(n,f)
terms.append(k)
n = n - f(k)
return terms

#for example, find_terms(78,square) returns [8,3,2,1]
#since 78 = 64 + 9 + 4 + 1



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.