Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #11783

Re: C o m p e t i t i o n .

Message-Id <fu26dh-n43.ln1@aretha.foo>
From Peter 'Shaggy' Haywood <phaywood@alphalink.com.au>
Subject Re: C o m p e t i t i o n .
Newsgroups comp.programming
Date 2021-01-15 02:01 +1100
References (5 earlier) <rtki1p$8i8$1@dont-email.me> <048c734d-9e15-4708-ab3c-a4b861192584n@googlegroups.com> <rtmdkt$fro$1@dont-email.me> <93b7395f-168b-4010-8f63-fc36c8c7de6dn@googlegroups.com> <rtnjjk$2ci$1@dont-email.me>

Show all headers | View raw


Groovy hepcat Richard Heathfield was jivin' in comp.programming on Thu,
14 Jan 2021 07:01 am. It's a cool scene! Dig it.

> On 13/01/2021 10:31, Y A wrote:
>> Richard Heathfield kirjutas kolmapäev, 13. jaanuar 2021 kl 11:14:09
>> UTC+2:
>>> On 12/01/2021 23:25, Y A wrote:
>>>> Richard Heathfield kirjutas teisipäev, 12. jaanuar 2021 kl 18:17:01
>>>> UTC+2:
>>>>> On 12/01/2021 13:17, I I wrote:
>>>>>
>>>>> <snip>
>>>>>> I am so sorry, that You have not attended school . . . . . .
>>>>> Irony is always amusing, but the more so when unintentional.
>>>>
>>>> Hmmmmmmmmmmmmmmmmmmmm...........................
>>>> Cross sum isn't logically: sum of all digits?
>>>> abcde cs=a+b+c+d+e
>>> I'd never heard the term before the OP used it at the beginning of
>>> this thread, so I looked it up.
>>>
>>> The only meaning I could find for it online was "sum of all digits"
>>> (i.e. the digital root), so I calculated the sum of all digits.
>>>
>>> Presumably the OP (who has a different result) means something
>>> different by it, but he appears unwilling to share that meaning with
>>> us.
>> 
>> OP=me
> 
> Then you ought to know what you mean by "cross sum", so you ought to
> be in a position to share that information.
> 
> If you mean "digital root", I've already given the correct answer,
> which you say is different to your answer, which means you're wrong.

  Just to add my two cents to this discussion, for what it's worth
(somewhere between one and three cents, presumably), I wrote, compiled
and ran the following program. It bears out Richard's results.

=====================================================================
#include <stdio.h>
#include <string.h>

/* Calculate the "cross sum" (ie., digital root or sum of all the
digits) for the given term. */
unsigned long cross_sum(const char *term)
{
  unsigned long sum = 0;
  const char *digit;

  for(digit = term; '\0' != *digit; digit++)
    sum += (*digit - '0');

  return sum;
}

#define BIG_ENOUGH 10

int main(void)
{
  const char *init_term
= "58349863148967341986793418678943167894317568943579812347643263461438776834177468314765864533703574653715456716465804656089576907569568456680257542768434686845796847604780607596864802468874265807426587026578406466539046579467684906749046758049663588463065836688638658768635806365889683658746862486247487652774625076485806648907696785970467957869053868763688046236880752825686569877668097860897676807746897456368844688745768468242622686282862869874986865749685796854096857706759759674569074359357697539375903576096780074367589368590356896686539";
  unsigned long sum;
  char new_term[BIG_ENOUGH];

  sum = cross_sum(init_term);
  sprintf(new_term, "%lu", sum);
  printf("sum = %lu\n", sum);
  while(1 < strlen(new_term))
  {
    sum = cross_sum(new_term);
    sprintf(new_term, "%lu", sum);
    printf("sum = %lu\n", sum);
  }

  return 0;
}
=====================================================================

  Results:

sum = 2977
sum = 25
sum = 7


-- 


----- Dig the NEW and IMPROVED news sig!! -----


-------------- Shaggy was here! ---------------
              Ain't I'm a dawg!!

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

C o m p e t i t i o n . I I <he12457@hotmail.com> - 2021-01-09 11:25 -0800
  Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-10 09:21 +0000
    Re: C o m p e t i t i o n . I I <he12457@hotmail.com> - 2021-01-10 12:01 -0800
      Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-10 22:15 +0000
        Re: C o m p e t i t i o n . I I <kpuctjanpobam@mail.com> - 2021-01-12 05:17 -0800
          Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-12 16:16 +0000
            Re: C o m p e t i t i o n . Y A <kpuctjanpobam@mail.com> - 2021-01-12 15:25 -0800
              Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-13 09:14 +0000
                Re: C o m p e t i t i o n . Y A <kpuctjanpobam@mail.com> - 2021-01-13 02:31 -0800
                Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-13 20:01 +0000
                Re: C o m p e t i t i o n . ند ارائه نماييدبا تشکر ند ارائه نمايي تش <kpuctjanpobam@mail.com> - 2021-01-14 08:29 -0800
                Re: C o m p e t i t i o n . ند ارائه نماييدبا تشکر ند ارائه نمايي تش <kpuctjanpobam@mail.com> - 2021-01-14 08:48 -0800
                Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-14 19:16 +0000
                Re: C o m p e t i t i o n . H e <he12457@hotmail.com> - 2021-01-14 11:28 -0800
                Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-15 07:46 +0000
                Re: C o m p e t i t i o n . Peter 'Shaggy' Haywood <phaywood@alphalink.com.au> - 2021-01-17 23:23 +1100
                Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-22 06:36 +0000
                Re: C o m p e t i t i o n . David Brown <david.brown@hesbynett.no> - 2021-01-15 11:13 +0100
                Re: C o m p e t i t i o n . Peter 'Shaggy' Haywood <phaywood@alphalink.com.au> - 2021-01-15 02:01 +1100
                Re: C o m p e t i t i o n . Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-01-15 00:23 +0000
                Re: C o m p e t i t i o n . David Brown <david.brown@hesbynett.no> - 2021-01-15 13:56 +0100
                Re: C o m p e t i t i o n . H e <he12457@hotmail.com> - 2021-01-17 03:23 -0800
                Re: C o m p e t i t i o n . Richard Heathfield <rjh@cpax.org.uk> - 2021-01-17 18:43 +0000

csiph-web