Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:32:25+00:00 2026-05-26T08:32:25+00:00

Help me come up with an obfuscated way to multiply a number by 2,

  • 0

Help me come up with an obfuscated way to multiply a number by 2, accurate to the second decimal.

Ideas:

  • use the Russian multiplication technique
  • trig / other mathematical identities
  • monte carlo methods
  • but of course bonus points for CS trickery

edit:

Just remembered that it’s probably more appropriate to think of this in terms of significant figures, not accurate decimal places. So go for 4 matching leading digits.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:32:25+00:00Added an answer on May 26, 2026 at 8:32 am

    The following perl one-liner doubles the first command-line argument:

    perl -e '$/=$\=shift;map$\+=$//(++$|+$|)**$_,(++$...$=);print'
    

    You may say that using perl is cheating because everything is obfuscated in perl. You would not be entirely wrong.

    Here’s a slightly different approach in (unobfuscated) python:

    import math
    def double(n) :
        if n == 0 :
            return 0
        a = b = n
        for i in range(1,100) :
            a = 2 + 1.0/a
        a = a - 1
        for i in range(1,100) :
            b = a * b
            a = math.sqrt(a)
        return b
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help trying to come up with a way to set this
I'm needing help to come up with a clever way of keeping track of
Hoping someone can help me with a slight hurdle I've come up against in
I've come across 2 confusing problems in SML and was hoping someone could help
I have downloaded several new plugins which come with a help file. None of
I have a problem I'm hoping someone has come across and can help. I
I'm not really good with regular expressions, so I'm hoping someone could help come
I want to use VIM to edit reStuctured text documents in a number of
Occasionally I search for some JavaScript help and I come upon the term Server-side
I come from a procedural programming background, and need some help grasping how methods

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.