Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ Challenge

Name: Anonymous 2012-02-01 10:00

Create a program which determines the total amount of dubs for a given range of numbers. Keep in mind that 00, 11, 22, etc. aren't the only kind of dubs you can have; 3 is 11 in binary, 1414 is 2-digit dubs, 257257 is 3-digit dubs, etc.

Name: Anonymous 2012-02-01 10:04

1414 is 2-digit dubs, 257257 is 3-digit dubs
So every range has an infinite amount of dubs because of 0-digit dubs?

Name: Anonymous 2012-02-01 10:19

This checks if a specific number is dubs:
(define dubs? (lambda (num) #t))
Implement any other features (such as iterating through a range/printing it out/whatever) yourself.

Name: Anonymous 2012-02-01 10:32

def count_dubs(n, base):
  size = base; m = 0
  while size < n:
    if n % size == n / size % size:
      m += 1
    size *= base
  return m

def dub_range(a, b):
  m = 0
  for n in range(a, b):
    for base in range(2, n):
      m += count_dubs(n, base)
  return m

print dub_range(0, 1001)


This counts 122122 as both 1-digit and 3-digit dubs; is it supposed to?

Name: Anonymous 2012-02-01 10:55

>>4
yes, some dubs are double dubs

nice dubs bro

Name: Anonymous 2012-02-01 10:58

>>2
the dubs have to be checkable

you can't check 0-digit dubs

not dubs bro

Name: Anonymous 2012-02-01 12:38

>>6
Check my 0-digit dubs

Name: Anonymous 2012-02-01 12:45

>>6

lisp> (dubs? 6)
#t


I just checked your dubs. What now?

Name: Anonymous 2012-02-01 16:53

>>8
nice dubs bro

Name: Anonymous 2012-02-01 16:55

Check my operator dubs.

--10

or

----10

or

------10

...

Name: Anonymous 2012-02-01 16:57

>>10
OPERATE MY ANUS

Name: Anonymous 2012-02-01 22:09

too much dubs

Name: Anonymous 2012-02-02 0:00

So if I wanting to find total number of dubs in range the 0-1000, would I consider "10" as the "0010" (leading zeroes)?

Thanking you sir,

Rajeez Shimananbaskaran
Head Clerk
Enterprise Software Solutions Dept
Apu Brothers Software Pvt. (Ind) Ltd.
Bengaluru
Karnataka
INDIA

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List