Code point sum quine

20

1

All the challenges on this site are focused on byte count, or the characters themselves. This one is different. Your challenge is to write a program that produces output which has a code point sum identical to the source's code point sum.

To produce a code point sum:

  1. Find the values of the characters in the program's character set.
    For example - FOO in ASCII: F = 70, O = 79, O = 79
  2. Add them all together.
    Code point sum of FOO in ASCII: F+O+O = 70+79+79 = 228.

An example of an ASCII sum quine would be if the source code was ABC and the output was !!!!!!. This is because the sum of the the ASCII values of the source (A = 65, B = 66, C = 67, sum = 198) is the same as the sum of the ASCII values in the output (! = 33, 33*6 = 198). BBB would also be valid output, as would cc.

Rules

  • Your program must not be a reverse, shuffled, error, or any other type of "true" quine. To elaborate: If the output contains all the same characters as the source, it is invalid.
  • Your program cannot use any errors/warnings from the compiler/interpreter as the output.
  • Your program's source must use the same codepage as the output.
  • Your program may use any codepage that was created before this challenge was.
  • Your program's output must not contain any unprintable characters (e.g. ASCII 0 through 31, or above 127) aside from linefeeds and tabs.
  • Standard loopholes apply.
  • If the source and/or output has a trailing linefeed, it must be included in the code point sum.
  • Compiler flags need to be included in the final byte count (score), but not the source's code point sum.
  • The output/source may not be empty.

Scoring

Shortest answer in byte count (not code point sum) wins. Please use this header format answers:

# Jelly, 12 bytes, sum 56 (SBCS)

You can use this tool to calculate ASCII sums.

Reference

Here are some useful codepage references.

/* Configuration */

var QUESTION_ID = 135571; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = (function(){
  var headerTag     = String.raw `h\d`
  var score         = String.raw `\-?\d+\.?\d*` // with negative/floating-point support
  var normalText    = String.raw `[^\n<>]*` // no HTML tag, no newline
  var strikethrough = String.raw `<s>${normalText}</s>|<strike>${normalText}</strike>|<del>${normalText}</del>`
  var noDigitText   = String.raw `[^\n\d<>]*`
  var htmlTag       = String.raw `<[^\n<>]+>`

  return new RegExp(
  String.raw  `<${headerTag}>`+
  String.raw    `\s*([^\n,]*[^\s,]),.*?`+
  String.raw    `(${score})`+
  String.raw    `(?=`+
  String.raw      `${noDigitText}`+
  String.raw      `(?:(?:${strikethrough}|${htmlTag})${noDigitText})*`+
  String.raw      `</${headerTag}>`+
  String.raw    `)`
  );
})();

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<i>' + a.language + '</i>').text().toLowerCase();
    
    languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link, uniq: lang};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.uniq > b.uniq) return 1;
    if (a.uniq < b.uniq) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  float: left;
}

#language-list {
  padding: 10px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654">
<div id="language-list">
  <h2>Winners by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>

<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr>
  </tbody>
</table>

MD XF

Posted 2017-07-25T03:32:55.130

Reputation: 11 605

Are comments allowed? – musicman523 – 2017-07-25T05:02:38.927

@musicman523 yes, I guess so. – MD XF – 2017-07-25T05:04:00.143

Why disallow warnings? I feel that's unnecessary. – Conor O'Brien – 2017-07-25T16:55:18.140

1@ConorO'Brien Warnings are not allowed to be the output of the program, e.g. no error quines. I guess that's unclear, one minute. – MD XF – 2017-07-25T16:56:04.320

What's the policy on flags? – Okx – 2017-07-25T19:17:08.010

@Okx Compiler flags need to be included in the final byte count, but not the source's code point sum. I've updated to include this in the post. – MD XF – 2017-07-25T19:42:39.697

@MDXF why is this impossible in Lenguage :c – V. Courtois – 2017-07-26T12:19:02.143

@V.Courtois It should be technically possible, if nothing simpler works you can always do a full quine construction. Of course full quine constructions are awkward and verbose already in the base brainfuck... – Ørjan Johansen – 2017-07-26T18:39:32.737

@ØrjanJohansen Yeah ... quine does exist in Lenguage but I can't find a way to get a small quine. – V. Courtois – 2017-07-26T19:22:43.683

If an empty program outputs nothing (not even a linefeed), is that valid? – Mego – 2017-07-26T22:52:27.283

@Mego No, it's not. I meant to include that in the rules, which I've updated. – MD XF – 2017-07-26T23:29:42.710

Does our output need to be deterministic? That is: Is it ok if my program randomly outputs one of several output but always outputs something with the proper sum? – Post Rock Garf Hunter – 2019-10-11T04:30:27.333

Answers

24

Retina, 1 byte, sum = 58 (ASCII)

:

This counts the matches of : in the input (0), so it prints

0

The code points of :, 0, and LF (linefeed) are 58, 48, and 10 (respectively), and 58 = 48 + 10.

Try it online!

Dennis

Posted 2017-07-25T03:32:55.130

Reputation: 196 637

14

ArnoldC, 316 bytes, sum 20992 (ASCII)

Fun enough.

IT'S SHOWTIME
HEY CHRISTMAS TREE s
YOU SET US UP 1
HEY CHRISTMAS TREE iaV
YOU SET US UP 0
STICK AROUND s
GET TO THE CHOPPER iaV
HERE IS MY INVITATION iaV
GET UP 8
ENOUGH TALK
TALK TO THE HAND "H"
GET TO THE CHOPPER s
HERE IS MY INVITATION 2048
LET OFF SOME STEAM BENNET iaV
ENOUGH TALK
CHILL
YOU HAVE BEEN TERMINATED

I used this and this to do my calculations. Took me an hour and a half. But fun.

Try It Online!

How it works

STICK AROUND is a loop, that loops 2048 times on the index iaV, but this index steps by 8. So there is 256 loops, printing H and a linefeed (72+10 = 82, 82*256 = 20992).

This is still HIGHLY golfable (by finding other calcs) but it is long and boring to measure your byte sum every time you do a modification.

Please tell me if I'm mistaken anywhere.

V. Courtois

Posted 2017-07-25T03:32:55.130

Reputation: 868

1The best ArnoldC answer I've seen. – Magic Octopus Urn – 2017-07-25T17:25:22.567

1@MagicOctopusUrn thanks xD it's my first try on this language (¿¿??!?!? still not sure it is one) – V. Courtois – 2017-07-25T17:54:04.037

https://github.com/samshadwell/TrumpScript is another pointless "language" if you want to emulate the president of the USA. – Magic Octopus Urn – 2017-07-25T17:55:38.263

@MagicOctopusUrn well ima doing this challenge in trumpscript then. – V. Courtois – 2017-07-25T17:59:09.647

@MagicOctopusUrn done – V. Courtois – 2017-07-25T18:50:11.987

Golfed down to 187 bytes: Try it online! sum is 12300. You don't need the second variable at all... and given the var s is used 4 times, changing the character gives you a lot of leverage to merge answers.

– TemporalWolf – 2017-07-26T21:45:50.243

@TemporalWolf well done! I do think (seeing how much it is different) you can post it for you :) – V. Courtois – 2017-07-26T21:50:56.290

1So I found out ArnoldC supports unicode output and shaved an additional 2 bytes off. I've posted it separately (with acknowledgement) – TemporalWolf – 2017-07-26T22:23:39.787

9

Charcoal, 1 byte, sum = 180 (Charcoal SBCS)

Try it online! In Charcoal's code page, has a code of 0xB4 = 180, while the output is 4 -s which is 4 * 45 = 180.

Neil

Posted 2017-07-25T03:32:55.130

Reputation: 95 035

8

Python 2, 11 bytes, sum 838 (ASCII)

print 76**8

prints

1113034787454976

Not very clever but it works

Try it online!

gkardos

Posted 2017-07-25T03:32:55.130

Reputation: 81

Great first answer; welcome to the site! I can verify that the ASCII sum is correct.

– MD XF – 2017-07-25T19:44:10.597

This is a polygot, it also works in Groovy, very impressive. – Magic Octopus Urn – 2017-07-25T19:45:53.940

2Great answer, but doesn't the output have a trailing linefeed which has to be added? – Reinstate Monica – 2017-07-25T22:38:28.087

This also works in ruby – Alexis Andersen – 2017-07-26T12:20:13.090

7

Jelly, 12 bytes, sum 948 (SBCS)

You said:

Jelly, 12 bytes

then it's Jelly, 12 bytes.

\
³³³,:D+++

Was fun, since I don't know Jelly at all.

How it works

I don't have any idea. But ³ does put 100 in the stack, , puts the stack in an array or something, : might concatenate the thing while D lists every letter of the last numeral (which does not exist), and +++ are for fun. The first and last line does not affect the output :)

Try it Online!

Used this to count.

V. Courtois

Posted 2017-07-25T03:32:55.130

Reputation: 868

4"I know what ³ and D does, but don't ask me WTF anything else does." - This would also be my write-up if I did a Jelly answer. – Magic Octopus Urn – 2017-07-25T19:02:26.080

6

CJam/Japt/bc, 2 bytes, sum 97 (ASCII)

A

Try it Online (CJam), Try it Online (Japt) (thanks @shaggy),

The bc version works on command line, but not TIO.

Outputs 10

Source: A + Space = 65 + 32 = 97

Output: 1 + 0 = 49 + 48 = 97

geokavel

Posted 2017-07-25T03:32:55.130

Reputation: 6 352

This also works in Japt. – Shaggy – 2017-07-25T06:19:06.280

I don't think this works in bc. All versions I know insist on a trailing newline. – Dennis – 2017-09-27T11:33:13.500

@Dennis I just ran the bc program and then typed in A. Should I call it bc REPL? – geokavel – 2017-10-04T18:28:00.450

5

Haskell, 9 bytes, byte sum 743 (ASCII)

Code:

show$29^9

Output:

14507145975869

Try it online!

Anders Kaseorg

Posted 2017-07-25T03:32:55.130

Reputation: 29 242

5

Some of these answers contain characters that will likely be invisible to you (particularly ASCII 17), click the TIO links to see their placement.

Klein 100/110, 4 bytes, sum 147

1
@

Try it online!

Output:

1 1

Klein 201, 4 bytes, sum 147

1
@

Try it online!

Output:

1 1

Klein (any topology), 5 bytes, sum 221 (ASCII)

111@

Try it online!

This prints

1 1 1

Post Rock Garf Hunter

Posted 2017-07-25T03:32:55.130

Reputation: 55 382

A thanks to whoever just upvoted this out of the blue. You got me to take a second look at this and now I've improved it a bit. – Post Rock Garf Hunter – 2019-10-11T04:23:46.770

@JoKing I'd say post that as your own answer. Its quite smart and is more than just an improvement on what I've done. – Post Rock Garf Hunter – 2019-10-11T05:35:38.030

5

Cubically, 4 bytes, sum 141 (ASCII)

%44E

Outputs 3636. Try it online! And here's the ASCII sum checker I used.

Explanation:

  • % means 'print face sum as integer'.
  • 4 prints the sum of all values on the BACK face (36) twice.
  • E is a no-op, just used to get the required sum.

MD XF

Posted 2017-07-25T03:32:55.130

Reputation: 11 605

hahaha, take my upvote – Giuseppe – 2017-07-25T16:50:24.603

4

Java 7, 88 85 bytes, sum 7808 7617 7507 (ASCII)

class
w{public
static
void
main(String[]H){for(int
B=0;B<77;)System.out.print(B++);}}

Almost certainly golfable. It's pretty easy to tweak since we have some spare variables like the name of the class and the name of the program arguments parameter that we can change freely.

Test it online!

Try it online!


Java 8, 84 bytes, sum 7434

Credit goes to Kevin Cruijssen.

interface A{static void main(String[]G){for(int A=59;A-->0;)System.out.print("~");}}

Test it online!

Try it online!

Poke

Posted 2017-07-25T03:32:55.130

Reputation: 3 075

Good job, I can verify it works here. Would +1 but I'm out of votes.

– MD XF – 2017-07-25T20:06:09.647

Converting it to Java 8 you can use this: interface A{static void main(String[]G){for(int A=59;A-->0;)System.out.print("~");}} to golf it by 4 bytes and lower it to 7434 as sum. Try it here. and Verify the resulting sum.

– Kevin Cruijssen – 2017-09-27T11:10:32.600

1@KevinCruijssen I would like to keep my answer in Java 7 but I have added your Java 8 solution to my answer and credited you. If you'd rather post yourself I can remove your answer from mine. – Poke – 2017-09-27T17:26:33.240

3

Python 2, 11 bytes, byte sum 854 (ASCII)

Code (with trailing newline):

print'z'*7

Output (with trailing newline):

zzzzzzz

Try it online!

Anders Kaseorg

Posted 2017-07-25T03:32:55.130

Reputation: 29 242

why doesn't the <code> section work? I mean, I can see trailing newline on preview when I edit your post, but we can't see it on the post. – V. Courtois – 2017-07-26T07:07:12.537

@V.Courtois Browser differences (e.g. works in Firefox, doesn’t work in Chrome). That’s why I explicitly pointed out the newline. – Anders Kaseorg – 2017-07-26T07:10:37.010

ok, seems like it's something I'll have to do next. But why does the second section react well then? :o – V. Courtois – 2017-07-26T07:18:58.697

3

brainfuck, 3 bytes - byte sum 255 (ISO-8859-1)

-.¤

Try it online!

Requires 8-bit cells. Prints the character ÿ, which is value 255. ¤ is a no-op to fill the sum.

musicman523

Posted 2017-07-25T03:32:55.130

Reputation: 4 472

3

Mathematica, 2 bytes, sum=101 (ASCII)

E + Space returns e

E 

Mathematica, 2 bytes, sum=105 (ASCII)

it works for I, too

I + Space returns i

I 

J42161217

Posted 2017-07-25T03:32:55.130

Reputation: 15 931

3

V, 2 bytes, Sum 255 (Latin1)

á

Try it online!

Hexdump:

00000000: 1ee1                                     ..

The first character is ctrl-^, or LATIN1/ASCII code-point 0x1E. The second character is alt-a, or the LATIN1 character 0xE1. This program outputs ÿ, which is 0xFF in LATIN1.

How does it work?

The first character is a no-op. It has no effect on the program at all. The second character is the append single character command. But we don't specify what character to append. So, due to implicit endings, it appends the character that V uses to signal the program is over, which just so happens to be 0xFF.

James

Posted 2017-07-25T03:32:55.130

Reputation: 54 537

Sum and codepage? – MD XF – 2017-07-25T16:52:10.907

@MDXF That's all in my explanation... – James – 2017-07-25T16:56:12.937

3

05AB1E, 5 bytes, sum 256 (05AB1E Base-255 Translation)

ΔTnon

Try it online!


This outputs: 1606938044258990275541962092341162602522202993782792835301376

Which, using 05AB1E's code-page results in: [1, 6, 0, 6, 9, 3, 8, 0, 4, 4, 2, 5, 8, 9, 9, 0, 2, 7, 5, 5, 4, 1, 9, 6, 2, 0, 9, 2, 3, 4, 1, 1, 6, 2, 6, 0, 2, 5, 2, 2, 2, 0, 2, 9, 9, 3, 7, 8, 2, 7, 9, 2, 8, 3, 5, 3, 0, 1, 3, 7, 6]

Which is: 256


Where the code is: ΔTnon

With code-points: [79, 29, 49, 50, 49]

Which is: 256

Magic Octopus Urn

Posted 2017-07-25T03:32:55.130

Reputation: 19 422

Which code page is this? This one lists 1 as 49, not 1.

– Dennis – 2017-07-25T18:50:23.700

@Dennis I went with whatever 05AB1E returned for the function base(char, 255), I had assumed (seemingly incorrectly) that they'd be one and the same. – Magic Octopus Urn – 2017-07-25T18:57:33.530

3

Taxi, 543 bytes, sum 47124 (ASCII)

374 is waiting at Starchild Numerology.Go to Starchild Numerology:w 1 l 2 r 1 l 1 l 2 l.Pickup a passenger going to The Underground.'~' is waiting at Writer's Depot.Go to Writer's Depot:w 1 r 1 l 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:n.[a]Pickup a passenger going to Cyclone.Pickup a passenger going to Post Office.Go to Zoom Zoom:n.Go to Post Office:w 3 l 2 r 1 l.Go to The Underground:n 1 r 1 l.Switch to plan "R" if no one is waiting.Pickup a passenger going to The Underground.Go to Cyclone:n 3 l 2 l.Switch to plan "a".[R]

Try it online! (Score verification)

The output is 374 tildes ~.

Engineer Toast

Posted 2017-07-25T03:32:55.130

Reputation: 5 769

2

Jelly, 3 bytes, sum = 152 (ASCII)

58+

Try it online!

Dennis

Posted 2017-07-25T03:32:55.130

Reputation: 196 637

2

Brain-Flak (Rain-Flak), 79 bytes

(((((((((((((((((((((((((((((((((()()()()){}){})))))))))))))))))))))))))))))))

Try it online!

This prints 16 and a newline 31 times.

Brain-Flak (BrainHack), 55 bytes

(((((((((((((((((((((()()()()){}){})))))))))))))))))))#

Try it online!

This prints 16 and a space 18 times.

Also 55 bytes

((((((((((((((((((((((()()()){}){}))))))))))))))))))))

Try it online!

This prints 12 followed by a space 19 times.

Post Rock Garf Hunter

Posted 2017-07-25T03:32:55.130

Reputation: 55 382

Sum and codepage? – MD XF – 2017-07-25T16:52:06.870

@MDXF I don't recall the sums but they are all ascii. – Post Rock Garf Hunter – 2017-07-25T16:52:44.073

The second and third don't seem right (they print 19 and 20 times the mentioned string), though you can fix them both, see here.

– ბიმო – 2017-07-25T21:35:47.710

2

Vim, 3 bytes, sum 234 (ASCII)

3iN

Output:

NNN

Try it online!

ბიმო

Posted 2017-07-25T03:32:55.130

Reputation: 15 345

2

Carrot, 4 bytes, sum = 279 (ASCII)

]^*2

Try it online!

Prints ]]].

user41805

Posted 2017-07-25T03:32:55.130

Reputation: 16 320

Way ahead of me in this one. I was no where close to getting a correct sum. – TheLethalCoder – 2017-07-25T10:12:19.147

@TheLethalCoder The ASCII sum of ^*3 was 187, so I tried solving x+187=4x, but that resulted in no integer solutions. So I went on to ^*2, which have me 186+x=3x which gave me x as 93, the code point of ]. That was all I did :) – user41805 – 2017-07-25T10:17:15.107

Ah smart way of doing it :) – TheLethalCoder – 2017-07-25T10:18:18.357

I assume then that ¹^*1 also works. If I did my maths correctly that is. Although that is the unicode value not utf8. – TheLethalCoder – 2017-07-25T10:22:45.620

@TheLethalCoder I'd suppose it depends on the encoding, because Carrot uses ASCII by default. – user41805 – 2017-07-25T10:25:21.137

2

Cubix, 20 bytes, code point sum 1505

OuOOQ++OOOOU@>!OOO<

Contains the unprintable character DEL (ascii 127).

Q pushes " (the largest constant available in cubix), then repeatedly prints out (O) 68 or 102 enough times to get it to 68686868686868102102102102102 which is 1505; through some trial and error I realized that I needed 81 more points than . (a Cubix no-op and ASCII 46) which resulted in needing DEL, which is still a no-op in Cubix.

Try it online!

On a cube:

    O u
    O O
Q + + O O O O U
@ > ! O O O  <
    . .
    . .

Giuseppe

Posted 2017-07-25T03:32:55.130

Reputation: 21 077

1

I saw "Cubix" and read "Cubically", had to catch myself before I gave you a bounty... sigh +1

– MD XF – 2017-07-25T16:37:59.103

@MDXF challenge accepted – Giuseppe – 2017-07-25T16:39:49.800

Beat you :P – MD XF – 2017-07-25T16:46:26.070

2

dc, 7 bytes, sum 720 (ASCII)

[my]fff

(91+109+121+93+(102*3)=720)

Outputs:

my
my
my

((109+121+10)*3=720)

brhfl

Posted 2017-07-25T03:32:55.130

Reputation: 1 291

2

Cubix, 11 bytes, byte sum 954 (ASCII)

Code:

vOw~N(!@O^|

Output:

998877665544332211

Verified here!

Try it online!

Cubified:

    v O
    w ~
N ( ! @ O ^ | .
. . . . . . . .
    . .
    . .
  • N initializes the stack with 10
  • (! decrement and test for truthy
    • @ on zero halt
  • O^O output current number redirect to top face and output again
  • vw redirect back to the ( decrement to begin the loop again

Watch it run

MickyT

Posted 2017-07-25T03:32:55.130

Reputation: 11 735

2

Cubically, 3 bytes, sum = 105 (ASCII)

%4

The third byte is DLE, which has code point 16, so the code point sum of the source code is
37 + 52 + 16 = 105.

The program prints

36

whose code point sum is 51 + 54 = 105.

Try it online!

Dennis

Posted 2017-07-25T03:32:55.130

Reputation: 196 637

*implements DLE* sorry, invalid. :P +1 – MD XF – 2017-07-26T02:52:07.050

Oh, I didn't see another Cubically solution here. Whoops! – TehPers – 2017-07-26T15:42:01.620

1

Ly, 10 5 bytes, byte sum 679 381 (ASCII)

97^u:

Outputs:

4782969

Try it online!

LyricLy

Posted 2017-07-25T03:32:55.130

Reputation: 3 313

1

Husk, 4 bytes, sum 334 (Husk SBCS)

up63

Output:

[3,7]

The value of a digit is given by 0x3? (where ? stands for that digit) and u,p,[,],, have values 0x75,0x70,0x5b,0x5d,0x2c - thus the sums are:

0x75 + 0x70 + 0x36 + 0x33        = 0x14e
0x5b + 0x33 + 0x2c + 0x37 + 0x5d = 0x14e

Try it online!

ბიმო

Posted 2017-07-25T03:32:55.130

Reputation: 15 345

1

JavaScript (ES6), 6 bytes, sum = 385 (ASCII)

Y=>1E7

Outputs 10000000. There are other 6 byte answers such as h=>1e8. Try this code point counter:

<input oninput=o.textContent=[...this.value].reduce(function(s,c){return(s+c.charCodeAt())},0)><pre id=o>0

Neil

Posted 2017-07-25T03:32:55.130

Reputation: 95 035

1

cQuents, 5 bytes, sum 238 (ASCII)

#3::$

Outputs 1,2,3, or in cQuents terms, prints the first three terms of the sequence 1,2,3,4,5,6....

Now listen. This was, literally, the first program I tried. The reason I tried it was because this was the program I used for Output with the same length as code. And it freaking worked.

Try it online!

Stephen

Posted 2017-07-25T03:32:55.130

Reputation: 12 293

1

Help, WarDoq!, 5 bytes, sum 1052 (Latin1)

l³ÿÿÿ

Prints

Hello World

Try it online!

Help, WarDoq! can add two numbers and test for primes, so it is considered as a valid programming language per this meta post.

Uriel

Posted 2017-07-25T03:32:55.130

Reputation: 11 708

1

Gaia, 4 bytes, sum 176 (SBCS)

6 5%

Explanation

In Gaia's codepage, linefeed has a code point of x7F (127 in decimal). Printable ASCII characters have the same code point as in ASCII.

This computes 6 modulo 5, which is 1, and prints 1 with a trailing linefeed.

Byte values of the characters in the codepage (in decimal):

6 5%: 54 + 32 + 53 + 37 = 176

1: 49 + 127 (linefeed) = 176

Business Cat

Posted 2017-07-25T03:32:55.130

Reputation: 8 927

1

Trumpscript, 131 bytes, sum 10600 (ASCII)

They wants to make war 110000000;make dark 10000000;as long as,dark less war;:make dark,dark plus 1000000;say "00"!america is great

Is this real life?

Check with this.

Thanks @MagicOctopusUrn for telling me that exists.

V. Courtois

Posted 2017-07-25T03:32:55.130

Reputation: 868

1

PHP, 12 9 bytes, sum 481

<?=10**9;

prints 1000000000

Try it online.

other solutions:

PRINT 5**19;    # 12 bytes, sum 731, output 19073486328125
Print 4/31;     # 11 bytes, sum 815, output 0.12903225806452
Print 8/7;      # 10 bytes, sum 774, output 1.1428571428571
<?=5<<29;       #  9 bytes, sum 523, output 2684354560

Titus

Posted 2017-07-25T03:32:55.130

Reputation: 13 814

1

Whitespace, 105 bytes, sum 2232 (ASCII)

   	

   	    		
 
 	
 	   	 	 
	
     	
	    
    		  	
	  	
	  	   	 	

 
 	    		

   	   	 	
 




		

Well you can't see the code but it's here ._.

I did put two <tab>s at the end (that doesn't affect the program) to match sum.

Explanation

The program counts from 1 to 24. I used the example you can find in this tutorial at the Annotated Example section.
For those who don't want to check this tutorial:
It puts your number onto the stack, then loop until <line10>'s number is reached by the number on the stack. The loop prints your number on the stack to stdout, increments it by 1, and puts a space and a linefeed.

Try it online!

Counted with this.

V. Courtois

Posted 2017-07-25T03:32:55.130

Reputation: 868

1

Cubically (6 bytes, sum 309)

I thought I'd do this in your language just for fun. Turns out the solution is pretty simple since % can print out up to two characters for every one character.

F1%441

Output:

363621

TehPers

Posted 2017-07-25T03:32:55.130

Reputation: 899

You seem to like Cubically :D +1 – MD XF – 2017-07-26T15:50:57.317

@MDXF It's a fun language! Plus, aside from BF, it's the only esoteric language I'm familiar with. – TehPers – 2017-07-26T15:56:24.187

1

ArnoldC, 185 bytes, sum 14508

IT'S SHOWTIME
HEY CHRISTMAS TREE i
YOU SET US UP 6
STICK AROUND i
TALK TO THE HAND "२"
GET TO THE CHOPPER i
HERE IS MY INVITATION i
GET DOWN 1
ENOUGH TALK
CHILL
YOU HAVE BEEN TERMINATED

Try it online!

Code sum

Output sum

Special thanks to V. Courtois and their answer, in particular for providing the sum count scripts.

Pseudocode:

start
var i
i = 6
while i
    print "२\n"
    i
    = i
        - 1
    (end assignment)
(end loop)
(end program)

At this point, I don't see a way to further golf it, as the rest is boilerplate for ArnoldC... ArnoldC surprisingly supports unicode output, so it was just finding a unicode character which, when repeated 5 times, summed to the same as the code.


If printable unicode is off-limits:

ArnoldC, 187 bytes, sum 12300

IT'S SHOWTIME
HEY CHRISTMAS TREE q
YOU SET US UP 150
STICK AROUND q
TALK TO THE HAND "H"
GET TO THE CHOPPER q
HERE IS MY INVITATION q
GET DOWN 1
ENOUGH TALK
CHILL
YOU HAVE BEEN TERMINATED

Try it online!

Verification

TemporalWolf

Posted 2017-07-25T03:32:55.130

Reputation: 241

unicode~~ good work! – V. Courtois – 2017-07-26T22:43:06.810

@V.Courtois I think unicode is technically against the rules, and it certainly fails the ascii codepoint checker... I now want to make one that passes his ascii verifier with unicode xD – TemporalWolf – 2017-07-26T22:47:30.570

wait... pass ascii with unicode? but how? maybe in a language with implicit conversion to int (scala) but not arnold c lel, even if arnoldc is scala – V. Courtois – 2017-07-26T22:51:41.743

1@V.Courtois २ == -213 according to his ascii codesum... I think I could swing a mix of ascii/unicode that gives a codesum of near zero >:D. Not sure it's worth the effort though. Also, that unicode is 3 bytes, so TIO is wrong. – TemporalWolf – 2017-07-26T22:53:09.113

good luck with this, though I don't think having negative codes is quite legit >:D – V. Courtois – 2017-07-26T23:07:31.287

From the spec - "Your program's output must not contain any unprintable characters (ASCII 0 through 31, or above 127)" the second one is valid though. – MD XF – 2017-09-27T23:13:18.300

1

Z80Golf, 4 bytes, sum 354 (ASCII)

00000000: 3676 7e38                                6v~8

Try it online!

The output is vvv.

Slightly modified from my 3-byte Output same length as code.

Disassembly

start:
  ld (hl), $76  ; 36 76
  ld a, (hl)    ; 7e
  db $38        ; 38 ; jr c, 0

As always, (hl) allows to use the memory address 0 similar to a register with pre-loaded value. In this case, the program overwrites its first opcode to halt, and then loads the same value to a. Usual stack underflow causes v to be printed three times and return to the start of program.

The last instruction is a no-op added to match the sum. The alternative 3-byte vvv program (in the link above) is unusable here because the difference $7a translates to ld a, d, which interferes with the preceding ld a, $76 (and it can't be moved in order to halt correctly).

Bubbler

Posted 2017-07-25T03:32:55.130

Reputation: 16 616

1

Keg, 4 bytes, sum=272

Note: This is kept as 4 general pure ASCII one-byte encoding bytes. Keg has multiple code pages, and the user can alternate between them. The pure ASCII+EASCII code page is one of them.

\*

There are control characters in between the characters \ and *. The bytecode of 136 is counted as 2 bytes.

Try It Online!

How did I get this program?

First of all, the challenge wants us to solve an equation, and the sum of all of the numbers in the source code equals a mystery number passed through a mystery function. I chose the multiply-two function because it is powerful enough to allow the solving of the equation. This is what I get as a draft (replace 2 with its control-character form mentally):

\?2*

(I prepended an escaping instruction before the mystery character because I want the character to be pushed no matter what the character is. My previous attempt of the mystery character without escaping had failed. The character was ,, which is a Keg instruction.) Obviously the ord codes of \, 2, and * are 92, 2, and 42 respectively, so we've complete half of the equation:

x+92+2+42

The other half is simply multiplying x by 2.

2x=x+2+92+42
 x=136

Therefore I escaped the 136 character, which is unprintable. So I need to verify the solution in case the result is wrong:

2*136=136+2+92+42
  272=272

The solution is valid, therefore the program is a valid code point sum quine solution.

user85052

Posted 2017-07-25T03:32:55.130

Reputation:

Isn't this 5 bytes, since the 136 character counts for 2 bytes? (As it says on TIO) – EdgyNerd – 2019-10-06T12:29:13.247

Pretend that I'm using pure ASCII. – None – 2019-10-06T12:30:09.853

If I'm not mistaken any code points above 128 would be extended ascii, meaning it'd be two bytes still – EdgyNerd – 2019-10-06T12:34:39.233

It is two bytes in Unicode, but it is one byte in the code page. – None – 2019-10-06T12:35:31.447

Yeah I guess, though since the code page doesn't really exist yet I'd say keep it as 5 bytes until it's implemented and on TIO – EdgyNerd – 2019-10-06T12:40:04.263

If I recall correctly, Keg has multiple code pages, and users choose which code page they are using based on their current program. I think ASCII + Extended ASCII is one of them. (It is 4 bytes encoded in an SBCS code page.)

– None – 2019-10-06T12:57:13.900

1

Lost, 31 30 bytes, sum 1598

///x///<<<///
>!?<@]]1111<%
//

Try it online!

Output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Post Rock Garf Hunter

Posted 2017-07-25T03:32:55.130

Reputation: 55 382

1

Klein, 3 bytes, sum 138

$@&

Try it online!

This outputs 0 0 with a trailing newline (48 32 48 10). The executing parts are $, which swaps the top two values of the stack (taking implicit zeroes from the bottom) and @, which terminates the program and prints the stack. & is just there to balance out the codepoint sum, and isn't a valid instruction in Klein, nor is it actually parsed. Since the pointer doesn't wrap around any edge, this works in any topology of Klein.

Jo King

Posted 2017-07-25T03:32:55.130

Reputation: 38 234

1

Deadfish~, 5 bytes, sum = 574 (ASCII)

{ion}

Try it online!

Prints from 1 to 10, no spaces. n is a no-op (like most characters in deadfish~) which puts the code point sum where it needs to be.

Reinstate Monica

Posted 2017-07-25T03:32:55.130

Reputation: 1 382

1

Runic Enchantments, 6 bytes, sum=380

"Dz":@

Try it online!

D has a code-point-sum double that of " while z has the code-point-sum equal to : plus @. Duplicating the string (resulting in DzDz) then provides one copy to count for its own characters in the source and one copy to count for the remainder of the program. Getting a lower sum will be difficult, but I don't preclude it.

For comparison, the 6 byte quines are "'<~@> and variants of '<~@|" (any IP redirection command that turns a left-pointing IP into a right-pointing IP all work).

Draco18s no longer trusts SE

Posted 2017-07-25T03:32:55.130

Reputation: 3 053

1

How about a7p@9? There's probably a 4 byte solution floating about somewhere

– Jo King – 2019-10-12T07:35:31.423

@JoKing Nice! I figure there was probably one of that form, but I didn't have the mental energy to hash it out (work's been a real nightmare lately; client recently OK'd an extension that would allow us to write a better framework with the understanding that we were going to miss the deadline anyway, then two days later asked for something extra). – Draco18s no longer trusts SE – 2019-10-12T15:37:30.163

1

INTERCAL, 47 46 45 bytes, sum = 2945 (ASCII...?)

PLEASE,8<-#38DO,8SUB#8<-#6DOREADOUT,8DOGIVEUP

Try it online!

Prints seven null bytes followed by thirty-one underscores. One of six possibilities generated by a somewhat revised awful hacky Python script.

Unrelated String

Posted 2017-07-25T03:32:55.130

Reputation: 5 300

0

Triangular, 6 bytes, sum 306 (ASCII)

FA%%%<

Prints 151515. Check it here and Try it online!

Formats into this triangle:

  F
 A %
% % <

The IP starts reading southwest from the topmost character. < directs it east, so the code is read like this:

F%%%

F pushes 15 to the stack, % prints it. A was the necessary character to get the byte sums even.

MD XF

Posted 2017-07-25T03:32:55.130

Reputation: 11 605

0

Bitwise, 117 bytes, sum 5796 (ASCII)

MOV 1 &46 &1
LABEL &1
MOV 2 &1 &1
LABEL &2
NOT 1 *1
AND *1 2 *2
XOR 1 2 1
SL *2 &1 2
JMP @2 2
OUT &126 &1
JMP @1 1
;$

Outputs 46 tildes (~). Try it online!

This will be alot shorter once I add functions to Bitwise...

MOV 1 &46 &1     move l46 into r1 when l1 is truthy
LABEL &1         create label 1
MOV 2 &1 &1      move l1 into r2 when l1 is truthy
LABEL &2         \
NOT 1 *1          \
AND *1 2 *2        \_ all this code performs r1 = r1 - r2
XOR 1 2 1          /
SL *2 &1 2        /
JMP @2 2         /
OUT &126 &1      print l126 (~) when l1 is true
JMP @1 1         jump to jp1 when r1 is truthy
;$               byte fill :P

l is short for literal, r is short for register, jp is short for jump point. I'll update with a better explanation later.

MD XF

Posted 2017-07-25T03:32:55.130

Reputation: 11 605

0

Bash + coreutils, 13 bytes, sum = 1090 (ASCII)

yes c|   head

Note the three spaces after the pipe.

Output:

c
c
c
c
c
c
c
c
c
c

Output is 10 c's and 10 line feeds, ascii 99 and 10 respectively, for a total of 1090. Input is 121+101+115+32+99+124+32+32+32+104+101+97+100=1090.

Chris

Posted 2017-07-25T03:32:55.130

Reputation: 1 313

0

Perl 5, 8 bytes, sum = 688 (ASCII)

Input:

say"q"x6

Output:

qqqqqq

x is the repetition operator in perl. So "q"x6 is the same as qqqqqq. say prints the string with a following line feed.

Chris

Posted 2017-07-25T03:32:55.130

Reputation: 1 313

0

Python 3, 13 bytes, sum 950 (ASCII)

print('_'*10)

Try it online!

Matthew Jensen

Posted 2017-07-25T03:32:55.130

Reputation: 713

0

Actually, 6 4 bytes

Simply outputs 512. Adds 2 NOPs in order to get to that number.

9╙Ω☼

Try it online!

Explanation

9╙   512 is 2**9
  Ω  Unfortunately opcode 250 is an implemented instruction; 
     opcode 234 has to be used instead.
   ☼ Opcode 16 just for the bytecount; this is also not an instruction.

user85052

Posted 2017-07-25T03:32:55.130

Reputation:

0

Zsh, 11 bytes

<<< $[1e12]

Try it online!

Outputs 1000000000000. followed by a newline.

GammaFunction

Posted 2017-07-25T03:32:55.130

Reputation: 2 838