Wait what? It's back? Well, then. Today I ask you the 1000 first digits of tau. I think
@JWinslow23 will love this one. So if you remember how it's done, I ask you a program that have this output exactly (or more):
6.283185307179586476925286766559005768394338798750211641949889184615632812572417997256069650684234135964296173026564613294187689219101164463450718816256962234900568205403877042211119289245897909860763928857621951331866892256951296467573566330542403818291297133846920697220908653296426787214520498282547449174013212631176349763041841925658508183430728735785180720022661061097640933042768293903883023218866114540731519183906184372234763865223586210237096148924759925499134703771505449782455876366023898259667346724881313286172042789892790449474381404359721887405541078434352586353504769349636935338810264001136254290527121655571542685515579218347274357442936881802449906860293099170742101584559378517847084039912224258043921728068836319627259549542619921037414422699999996745956099902119463465632192637190048918910693816605285044616506689370070523862376342020006275677505773175066416762841234355338294607196506980857510937462319125727764707575187503915563715561064342453613226003855753222391818432840398
You're allowed mostly everything, a calc (scrolling or output to a Str variable might be needed), a PC, a Google Home that speaks the output, whatever. This is also a code golf contest: smaller is better, but it will also be judged on how original the method to produce or to show the output is, be it an algorithm, compression or whatever, and also how fast it is. You need not to have that output exactly, variations are allowed, as long as it shows more or less these digits. Standard code golf pitfalls from Stack Overflow applies.
Send the sources of your entries to
[email protected]. Contest ends Monday March 13th 23:59:59 EST. (Two weeks this time, because it's a big one.)
Note that the schedule is now whenever I feel like. Feel free to send ideas for future contests like this.
Tau on the Colecovision :
1k of RAM just isn't enough for Tau...
(https://gameblabla.nl/img/coleco_tau.png)
I will send you the binaries and the sauce.
Oooh, that nice. On that note, 1000 digits is not a hard limit if the system you're coding for don't allow for it, although there's algorithms that lets you calculate tau digit by digit, you might get around by throwing away the digit once it's displayed on screen.
This reminds me... Did i ever get my Hello World walrii points? :P
Oh yes, and now i have an interesting idea.. not sure if i could pull it off tho.
Ok juju, i found a workaround for the small memory. (just do it in several parts)
Tau fits on two-screen !
I will send you the new version
Quote from: Unicorn on February 28, 2017, 07:41:43 AM
This reminds me... Did i ever get my Hello World walrii points? :P
Ah yeah, the WalriiPoints. I'll look at this later.
EDIT: Also, just a tip, you shouldn't merely store the output in the program and print it, some transformation or generation should be done.
EDIT2: Tip #2: If the language you picked only allows for a limited number of decimals, you should find an algorithm that can go over that limit. There's some algos that can print arbitrary digits.
Woah nice
@gameblabla . Also
@Juju if 1000 is not an hard limit, then does it mean that the following code would have been acceptable in TI-83 Plus BASIC (at the cost of being nearly guaranteed to lose)? :trollface:
2π
I should put both of those tips I added in the post above in the OP.
EDIT: Here's my entry:
https://www.youtube.com/watch?v=aOsbMWuVA-Y
I just now noticed this.
I suppose I have to come up with something. TI-BASIC would be my target platform if I get this done, let's see if I can encode 1000 digits in less than 1KB. :P
EDIT: I already did this in <1KB, actually. For this specific problem, I optimized the previously-done (therefore invalid :P ) solution to 879 bytes, though it may not finish in the lifespan of your battery.
Goto 0
Lbl 1
If min(L₁)>0 and ᴇ10≥max(L₁
End
0→PMT
For([recursiven],1,dim(L₁
PMT+L₁([recursiven]→|N
int(|Nᴇ⁻10→PMT
|N-PMTᴇ10→L₁([recursiven]
End
If not(PMT
End
[recursiven]→dim(L₂
Ans→dim(ʟQ
Ans→dim(ʟR
Ans→dim(ʟT
PMT→L₁(Ans
End
Lbl 2
1+dim(L₁→|N
Repeat Ans or |N=1
|N-1→|N
L₁(|N)-L₂(|N
End
End
Lbl 0
SetUpEditor T,R,Q
{30→T
6Ans→R
{1→Q
ClrHome
"?→Str1
2→I%
Lbl 3
If 1<length(Str1
Then
"
If not(fPart((length(Str1)-2)/16
Output(6+C,1,sub(Ans+Ans,1,16
2+16int((length(Str1)-114)/16)(130≤length(Str1
Output(1,1,sub(Str1,Ans,1-Ans+length(Str1
End
5ʟT→L₁
For(θ,⁻1,0
If θ
Goto 1
End
L₁→L₂
(9I%-4)ʟQ→L₁
For(θ,⁻1,0
If θ
Goto 1
End
3L₁+5ʟR→L₁
For(θ,⁻1,0
If θ
Goto 1
End
0→PV
For(θ,⁻1,0
If θ
Goto 2
End
While Ans≥0
PV+1→PV
L₁-L₂→L₁
For(θ,⁻2,0
If θ=⁻2
Goto 1
If θ
Goto 2
End
End
sub("0123456789",PV+1,1
If I%=2
Ans+".
Str1+Ans→Str1
(5I%-2)ʟQ+ʟR-PVʟT→L₁
For(θ,⁻1,0
If θ
Goto 1
End
30L₁→L₁
For(θ,⁻1,0
If θ
Goto 1
End
If I%<33
Then
9I%²+9I%+2
Else
(3I%+1)L₁→L₁
For(θ,⁻1,0
If θ
Goto 1
End
3I%+2
End
AnsL₁→L₁
For(θ,⁻1,0
If θ
Goto 1
End
L₁→ʟR
10I%ʟQ→L₁
For(θ,⁻1,0
If θ
Goto 1
End
(2I%-1)L₁→L₁
For(θ,⁻1,0
If θ
Goto 1
End
L₁→ʟQ
3ʟT→L₁
For(θ,⁻1,0
If θ
Goto 1
End
If I%<33
Then
9I%²+9I%+2
Else
(3I%+1)L₁→L₁
For(θ,⁻1,0
If θ
Goto 1
End
3I%+2
End
AnsL₁→L₁
For(θ,⁻1,0
If θ
Goto 1
End
L₁→ʟT
I%+1→I%
If getKey≠45 and 1003>length(Str1
Goto 3
If 1003=length(Str1
Pause
ClrHome
If someone could post an algorithm to find all the terms of tao in succession i would be willing to golf something up in axe.
Quote from: c4ooo on March 01, 2017, 03:21:41 AM
If someone could post an algorithm to find all the terms of tao in succession i would be willing to golf something up in axe.
*tau
And I just posted one. :P
Also, I'm working on my TI-BASIC version, and right now, it's 505 digits in 428 bytes (including the 6. at the beginning). That's about 1.18 digits per byte!
Quote from: JWinslow23 on March 01, 2017, 03:55:39 AM
Quote from: c4ooo on March 01, 2017, 03:21:41 AM
If someone could post an algorithm to find all the terms of tao in succession i would be willing to golf something up in axe.
*tau
And I just posted one. :P
One that isn't in TI-BASIC :P
This paper has some in Haskell for pi. (http://www.cs.ox.ac.uk/jeremy.gibbons/publications/spigot.pdf) Adapting them to tau shouldn't be hard.
Bump.
I've been working on the spigot, and if I let it go infinitely and display one digit at a time, I can get it down to 383 bytes.
{30→T
6Ans→R
{1→Q
ClrHome
For(I,2,ᴇ4
⁻1→V
5ʟT
For(θ,V,0
If θ
Goto 1
End
ʟA→B
Ans+3(9I-4)ʟQ+5ʟR→A
Repeat Ans<0
IS>(V,9
ʟA-ʟB
For(θ,⁻1,0
If θ
Goto 1
End
End
Disp V
(5I-2)ʟQ+ʟR-VʟT
For(W,0,1
For(Z,1,2
If W
(3I+Z)ʟA
For(θ,⁻1,0
If θ
Goto 1
End
30ʟA
End
End
ʟA→R
10IʟQ
For(W,⁻1,0
For(Z,1,2
If not(W
(3I+Z)ʟA
For(θ,⁻1,0
If θ
Goto 1
End
(2I-1)ʟA
End
If W
ʟA→Q
If W
3ʟT→A
End
ʟA→T
End
Lbl 1
DelVar PAns→A
For(M,1,dim(ʟA
P+ʟA(M→N
int(Ansᴇ⁻9→P
N-Ansᴇ9→ʟA(M
End
If P
P→ʟA(M
dim(ʟA→dim(ʟB
Ans→dim(ʟQ
Ans→dim(ʟR
Ans→dim(ʟT
Ans→N
Repeat Ans or not(N
ʟA(N)-ʟB(N
DS<(N,0
End
End
I'm not joining in because it looks too hard but I found this.....
"Are you trying compute ALL the digits from the first to the Nth? Or are you just trying to get a few digits around the Nth binary digit? There is no reason to use the BBP formula if you want all the digits as there are MUCH faster formulas out there for Pi."
hehe force the tau beliefers to use a pi formula :thumbsup:
:trollface:
const double PI_DIV_2 = 1.5707963267948966192313216916398;
const double PI = 3.1415926535897932384626433832795;
const double PI_MUL_2 = 6.283185307179586476925286766559;
the ultimate solution!! ;)
Quote from: kotu on March 03, 2017, 12:01:03 PM
:trollface:
const double PI_DIV_2 = 1.5707963267948966192313216916398;
const double PI = 3.1415926535897932384626433832795;
const double PI_MUL_2 = 6.283185307179586476925286766559;
the ultimate solution!! ;)
You mean ETA, PI, and TAU. ;)
er, no :banghead: lol
why isn't there nyone backing ETA as the one true constant...? ???
Lance Henriksen 8)
Quote from: p2 on March 03, 2017, 12:24:59 PM
why isn't there nyone backing ETA as the one true constant...? ???
There is...
https://www.youtube.com/watch?v=1qpVdwizdvI
...but these people are rare to find, and the idea of eta being the "true" circle constant largely hinges on the argument that the right angle should be the fundamental unit, instead of the area of a unit circle with pi, or the circumference of a unit circle with tau. Which, as you know, I think is
silly.
Reminder that the contest ends tonight. I won't mind if anyone's late due to timezones or anything, but make sure your entry is submitted by email before I process the results. I'll show the results tomorrow on Pi (or Tau/2) Day live on YouTube or Twitch, stay tuned.
Were the results ever posted
@Juju ?
@JWinslow23 wins, stay tuned for contest #5.
JWinslow23- Code is mostly unreadable and obfuscated (+)
- Uses clever tricks with integers (+)
- Sometimes misses leading 0's (-)
- Program is less than 1K (+)
- 9/10
gameblabla- Uses an obscure console (+)
- Tau fits on 2 screens (+)
- Tau is stored in variables, then compressed and finally uncompressed for seemingly no reason (-)
- Source code is very readable (-)
- 6/10
Actually, the "sometimes missing leading 0's" is not a mistake. My program basically took numbers in base 100 and displayed them, and the numbers in question were digits of tau. Leading 0's on numbers seemed to be impossible to display, so I just trailed the previous numbers with 0 and then continued. All the digits are correct and in the right order.
For example:
8125724179
972560696
5068423413
If I'd have done that "optimally" and made 9725606965 the second line, the third line would have a leading 0 (which I couldn't figure out how to display).
Hope it makes sense now!
Congrats!
teach him how to program in a professional environment why don't ya!!
go
@Juju !!! well done!
If no one looks at the source, you could just display the first ~15 digits and just print random numbers after that :trollface:
I did not know that deliberately obfuscating the code was a feature.
Richard Stallman told me otherwise :(