user21301: Is it possible to generate private and public keys using only a calculator?   If not how many lines of code would it take to write a wallet generator, and how difficult would it be?   How would you do this? 

user9382: Bitcoin Address Generator in Obfuscated Python is a fun piece  of Python 2.7 code:
_                   =r"""A(W/2,*M(3*G
               *G*V(2*J%P),G,J,G)+((M((J-T
            )*V((G-S)%P),S,T,G)if(S@(G,J))if(
         W%2@(S,T)))if(W@(S,T);H=2**256;import&h
       ashlib&as&h,os,re,bi    nascii&as&k;J$:int(
     k.b2a_hex(W),16);C$:C    (W/    58)+[W%58]if(W@
    [];X=h.new("rip           em    d160");Y$:h.sha25
   6(W).digest();I$                 d=32:I(W/256,d-1)+
  chr(W%256)if(d>0@"";                  U$:J(k.a2b_base
 64(W));f=J(os.urando       m(64))        %(H-U("AUVRIxl
Qt1/EQC2hcy/JvsA="))+      1;M$Q,R,G       :((W*W-Q-G)%P,
(W*(G+2*Q-W*W)-R)%P)       ;P=H-2**       32-977;V$Q=P,L=
1,O=0:V(Q%W,W,O-Q/W*                      L,L)if(W@O%P;S,
T=A(f,U("eb5mfvncu6                    xVoGKVzocLBwKb/Nst
zijZWfKBWxb4F5g="),      U("SDra         dyajxGVdpPv8DhEI
qP0XtEimhVQZnEfQj/       sQ1Lg="),        0,0);F$:"1"+F(W
 [1:])if(W[:1           ]=="\0"@""        .join(map(B,C(
  J(W))));K$:               F(W          +Y(Y(W))[:4]);
   X.update(Y("\4"+                     I(S)+I(T)));B$
    :re.sub("[0OIl    _]|            [^\\w]","","".jo
     in(map(chr,ra    nge    (123))))[W];print"Addre
       ss:",K("\0"+X.dig    est())+"\nPrivkey:",K(
         "\x80"+I(f))""";exec(reduce(lambda W,X:
            W.replace(*X),zip(" \n&$@",["","",
               " ","=lambda W,",")else "])

I'd check out these two Python modules:

Bitcoinaddress 
Pybitcointools (a fantastic Bitcoin library: see the README.txt for usage)

A private key is just/can be a very large number. However it's not possible to use a calculator to calculate an address easily, mainly because:

modular arithmetic is involved
base 58 check is not a straightforward conversion
there's appended bytes and such

I'd recommend either this web app to get the next best thing.

21301: <p>Is it possible to generate private and public keys using only a calculator?   If not how many lines of code would it take to write a wallet generator, and how difficult would it be?   How would you do this? </p>
 9382: <p><a href="http://preshing.com/20131219/bitcoin-address-generator-in-obfuscated-python/" rel="nofollow">Bitcoin Address Generator in Obfuscated Python</a> is a fun piece  of <a href="http://www.python.org" rel="nofollow">Python</a> 2.7 code:</p>

<pre><code>_                   =r"""A(W/2,*M(3*G
               *G*V(2*J%P),G,J,G)+((M((J-T
            )*V((G-S)%P),S,T,G)if(S@(G,J))if(
         W%2@(S,T)))if(W@(S,T);H=2**256;import&amp;h
       ashlib&amp;as&amp;h,os,re,bi    nascii&amp;as&amp;k;J$:int(
     k.b2a_hex(W),16);C$:C    (W/    58)+[W%58]if(W@
    [];X=h.new("rip           em    d160");Y$:h.sha25
   6(W).digest();I$                 d=32:I(W/256,d-1)+
  chr(W%256)if(d&gt;0@"";                  U$:J(k.a2b_base
 64(W));f=J(os.urando       m(64))        %(H-U("AUVRIxl
Qt1/EQC2hcy/JvsA="))+      1;M$Q,R,G       :((W*W-Q-G)%P,
(W*(G+2*Q-W*W)-R)%P)       ;P=H-2**       32-977;V$Q=P,L=
1,O=0:V(Q%W,W,O-Q/W*                      L,L)if(W@O%P;S,
T=A(f,U("eb5mfvncu6                    xVoGKVzocLBwKb/Nst
zijZWfKBWxb4F5g="),      U("SDra         dyajxGVdpPv8DhEI
qP0XtEimhVQZnEfQj/       sQ1Lg="),        0,0);F$:"1"+F(W
 [1:])if(W[:1           ]=="\0"@""        .join(map(B,C(
  J(W))));K$:               F(W          +Y(Y(W))[:4]);
   X.update(Y("\4"+                     I(S)+I(T)));B$
    :re.sub("[0OIl    _]|            [^\\w]","","".jo
     in(map(chr,ra    nge    (123))))[W];print"Addre
       ss:",K("\0"+X.dig    est())+"\nPrivkey:",K(
         "\x80"+I(f))""";exec(reduce(lambda W,X:
            W.replace(*X),zip(" \n&amp;$@",["","",
               " ","=lambda W,",")else "])
</code></pre>

<p>I'd check out these two Python modules:</p>

<ol>
<li><a href="https://pypi.python.org/pypi/python-bitcoinaddress" rel="nofollow">Bitcoinaddress</a> </li>
<li><a href="https://github.com/vbuterin/pybitcointools" rel="nofollow">Pybitcointools</a> (a fantastic Bitcoin library: see the <a href="https://github.com/vbuterin/pybitcointools/blob/master/README.txt" rel="nofollow">README.txt for usage</a>)</li>
</ol>

<p>A private key is just/can be a very large number. However it's not possible to use a calculator to calculate an address easily, mainly because:</p>

<ul>
<li>modular arithmetic is involved</li>
<li>base 58 check is not a straightforward conversion</li>
<li>there's appended bytes and such</li>
</ul>

<p>I'd recommend either <a href="http://gobittest.appspot.com/Address" rel="nofollow">this web app</a> to get the next best thing.</p>
