mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2022-04-29, 14:11   #12
uau
 
Jan 2017

9216 Posts
Default

Quote:
Originally Posted by retina View Post
That is not correct.
Guess I'm too used to using the Python shell only through IPython. In IPython, a line with semicolons will only show the return value from the last statement (and the semicolon-using solutions here do not work), whereas plain Python shell will handle semicolon-separated statements as basically independent input lines - each will produce independent output, but '_' for example will refer to the return value of the last only.

BTW if anyone is using Python through its plain shell, I recommend trying IPython. I think things like multi-line block support are especially useful - if you write a loop with multiple lines, it's in the command history as one object, and you can easily repeat it with one part edited (instead of recalling each single line individually as the default shell would require).
uau is offline   Reply With Quote
Old 2022-04-29, 15:03   #13
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

73×89 Posts
Default

Quote:
Originally Posted by uau View Post
... plain Python shell will handle semicolon-separated statements as basically independent input lines ...
I gave the hint in the first post with the output from float('-inf'); float('nan').

I did give some real hints, along with the fake float hint.
retina is online now   Reply With Quote
Old 2022-04-29, 20:44   #14
nordi
 
Dec 2016

1708 Posts
Default

OK, so you were looking for something like

1e666+1e666j;_*_;_*_;1e666-1e666j;_+1e666j;-1e666+1e666j;_-1e666j;-1e666-1e666j;_+1e666


Or, to make it even shorter and less readable:

j=1e666;e=3E333J;e+j;_*_;_*_;j-e;_+e;e-j;_-e;-j-e;_+j
nordi is offline   Reply With Quote
Old 2022-05-03, 01:24   #15
SmartMersenne
 
Sep 2017

131 Posts
Default

Quote:
Originally Posted by nordi View Post
OK, so you were looking for something like

1e666+1e666j;_*_;_*_;1e666-1e666j;_+1e666j;-1e666+1e666j;_-1e666j;-1e666-1e666j;_+1e666


Or, to make it even shorter and less readable:

j=1e666;e=3E333J;e+j;_*_;_*_;j-e;_+e;e-j;_-e;-j-e;_+j
These don't produce the output as requested. Here is what shows up on my computer:

(inf+infj)
(nan+infj)
(nan+nanj)
(inf-infj)
(inf+nanj)
(-inf+infj)
(-inf+nanj)
(-inf-infj)
(nan-infj)
SmartMersenne is offline   Reply With Quote
Old 2022-05-03, 01:26   #16
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

23·3·439 Posts
Default

To share something fellow geeks might enjoy... The Worst Programming Language Ever - Mark Rendle - NDC Oslo 2021
chalsall is offline   Reply With Quote
Old 2022-05-03, 03:57   #17
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

649710 Posts
Default

A shorter version:
i=1e666;k=1e666j;i+k;i-k;k*-1j;-i+k;-i-k;k*1j;i+i*1j;i-i*1j;i-k*-1j
retina is online now   Reply With Quote
Old 2022-05-03, 14:42   #18
nordi
 
Dec 2016

23×3×5 Posts
Smile

Quote:
Originally Posted by SmartMersenne View Post
These don't produce the output as requested. Here is what shows up on my computer:

(inf+infj)
(nan+infj)
(nan+nanj)
(inf-infj)
(inf+nanj)
(-inf+infj)
(-inf+nanj)
(-inf-infj)
(nan-infj)
And that's exactly what was requested:

Quote:
output all nine possibilities of ±inf and nan as a complex number.
nordi is offline   Reply With Quote
Old 2022-05-03, 15:03   #19
Gimarel
 
Apr 2010

22·3·19 Posts
Default

If the order doesn't matter this is shorter:
a=666e666;b=666e666j;a+b;-_;_+a;-_;a-b;-_;_-b;-_;_-a
And it should be obvious how to strip 4 more charakters.

Last fiddled with by Gimarel on 2022-05-03 at 15:12 Reason: 2 charackters less
Gimarel is offline   Reply With Quote
Old 2022-05-03, 16:31   #20
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

73·89 Posts
Default

The order doesn't matter.

"... should look like this." isn't the same as "... shall be this." IMO.

IIUC "like" means similar, not exact. At least in this context. I know there are other meanings of "like", but most of those would just make the sentence look weird.
retina is online now   Reply With Quote
Old 2022-05-04, 06:29   #21
SmartMersenne
 
Sep 2017

8316 Posts
Default

Quote:
Originally Posted by retina View Post
The order doesn't matter.

"... should look like this." isn't the same as "... shall be this." IMO.

IIUC "like" means similar, not exact. At least in this context. I know there are other meanings of "like", but most of those would just make the sentence look weird.
Sorry, my bad. I took it literally including the order of the output.
SmartMersenne is offline   Reply With Quote
Old 2022-05-14, 21:04   #22
axeltherabbit
 
axeltherabbit's Avatar
 
May 2022

1 Posts
Default

my solution:
i=0+9e+999j;r=9e+999;r+i;r-i;r+i-i;-r+i;-r-i;-r+i-i;r-r+i;r-r-i;r-r+i-i

it's a cool problem for a codegolf, I wonder what is the shortest possible solution
axeltherabbit is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complexity of Chinese Remainder Theorem carpetpool Miscellaneous Math 4 2017-02-09 19:26
What is the time complexity of base conversion? Mr. P-1 Computer Science & Computational Number Theory 5 2013-04-02 15:47
Complexity analysis of 3 tests kurtulmehtap Math 10 2013-03-20 14:15
Complexity of LLT T.Rex Math 9 2007-05-29 21:15
complexity of Pepin's test ixfd64 Math 14 2005-12-01 22:50

All times are UTC. The time now is 23:09.


Fri Jun 24 23:09:23 UTC 2022 up 71 days, 21:10, 0 users, load averages: 2.59, 4.34, 3.17

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔