Talk:Disan Count
I can see a few problems with a program like this for testing languages:
- You don't need to be able to do conditionals to write the program. You could do a loop counting by 2s, for example, and get at only the even numbers that way.
- It definitely doesn't require a language to be Turing-complete. For example, nothing about this enforces access to infinite memory (unless you require bignums) and it doesn't prove that a program can do an infinite loop. Plenty of languages are powerful enough to run this program, but not others.
--ais523 00:52, 14 December 2017 (UTC)
Yes, I should have been more specific. A Disan Count actually requires a step of one when going from 0 to n, and check for parity using an if statement. It also states that n should be 'as arbitrarily big as intended'. Also, in the original implementation it assumed the algorithm was implemented using jump statements in a way that the jump could happen indefinitely as long as the condition for it to jump was achieved. I will fix this page, thank you.
--Lartu (talk) 03:26, 14 December 2017 (UTC)Lartu
The problem still doesn't need Turing-completeness to work, though. You can solve it with a linear bounded automaton. For example, here's a Disan count in BuzzFizz:
# Ensure that n has been input. if n\$a: # do nothing else: # still do nothing if 2\$a: print $a if 2\$a: print " is even!\n" else: # do nothing $a++ if n\$a: # do nothing else: loop
This seems to obey all your requirements (a potentially infinite loop, checking for parity with an if statement, stepping $a
by 1 on each loop iteration), but the language falls short of Turing-completeness because it can't reliably read $a
once the value gets higher than the value in $n
, something which never comes up while running the Disan count. This sort of requirement is a very hard one to model in "one example program" demonstrations (unless the program is an interpreter for a Turing-complete language) because it's not enough to think of every potential problem that appears in your program; you have to think of every potential problem outside, too. There are infinitely many possible reasons a language might not be Turing-complete, and your program/requirements can only encompass finitely many of them. --ais523 12:14, 16 December 2017 (UTC)
- I can rephrase the statement in the second sentence much more strongly: if you want one example program that demonstrates that a language definitely is Turing-complete, that example program must be an interpreter for a Turing-complete language.
- That said, problems like Disan Count can still serve as disqualifying tests: if a language is claimed to be Turing-complete, but you can't implement Disan Count in it, then the claim is false. --Chris Pressey (talk) 08:33, 23 June 2020 (UTC)
What about considering this language: It's like Python, but will only work if your program is a disan count program? --None1 (talk) 13:04, 14 November 2023 (UTC)
Huh?
n = int(input()) a = 1 while a < n: if a % 2 == 0: print(f"{a}是双数!") else: print(f"{a}是单数!") a = a + 1
is this a true disan count?
i made a disan count on the ?Q? page but I'm not sure that its a true disan count because of these things:
- I'm not even sure that it counts with it using Bracket unary
- and also does the method of the disan count even meet the specification? like does the bracket balancer count as a conditional?
- is the loop even valid for a disan count?
please help --Gggfr (talk) 05:19, 4 August 2024 (UTC)
- Some of the requirements of a Disan count are hard to define precisely, but there's one fairly clear way it fails: the loop is counting downwards rather than upwards. It also isn't doing the conditional properly because the conditional is on the decrement rather than on the print (if the user enters an odd number, the
.
decrements twice). --ais523 05:46, 4 August 2024 (UTC)
Disan Count, but prime
BubbleLang:
function prime(x): if x > 1: if x in (2, 3): return True else: for i in range(2, x): if x % i == 0: return False else: if x == -1: return True else: return False var a = input() a = int(a) for i in range(1, a + 1, 1): if prime(i) == True: print(f"{i} is prime!\n") else: print(f"{i}\n")