Skip to main content
Tweeted twitter.com/StackCodeGolf/status/1504789724808032277
added 1 character in body
Source Link

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

Example program of how to calculate the Σ digit sumsums of your code:

from sys import stdin
score=lambda s:sum((ord(c)-1)%9+1for c in s if ord(c)>0)
bytes=lambda s:"".join(str([ord(c)for c in s]).replace(',','').replace(']','').replace('[',''))
dr_bytes=lambda s:"".join(str([(ord(c)-1)%9+1for c in s]).replace(',',' +').replace(']',' =').replace('[',''))
code="\n".join(stdin.readlines())
print(bytes(code))
print(dr_bytes(code), end=' ')
print(score(code))

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

Example program of how to calculate the Σ digit sum of your code:

from sys import stdin
score=lambda s:sum((ord(c)-1)%9+1for c in s if ord(c)>0)
bytes=lambda s:"".join(str([ord(c)for c in s]).replace(',','').replace(']','').replace('[',''))
dr_bytes=lambda s:"".join(str([(ord(c)-1)%9+1for c in s]).replace(',',' +').replace(']',' =').replace('[',''))
code="\n".join(stdin.readlines())
print(bytes(code))
print(dr_bytes(code), end=' ')
print(score(code))

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

Example program of how to calculate the Σ digit sums of your code:

from sys import stdin
score=lambda s:sum((ord(c)-1)%9+1for c in s if ord(c)>0)
bytes=lambda s:"".join(str([ord(c)for c in s]).replace(',','').replace(']','').replace('[',''))
dr_bytes=lambda s:"".join(str([(ord(c)-1)%9+1for c in s]).replace(',',' +').replace(']',' =').replace('[',''))
code="\n".join(stdin.readlines())
print(bytes(code))
print(dr_bytes(code), end=' ')
print(score(code))
added 427 characters in body
Source Link

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

PS: You could also look at my sad web appExample program of how to calculate the Σ digit sum of your code: https://thevortex.netlify.app/

from sys import stdin
score=lambda s:sum((ord(c)-1)%9+1for c in s if ord(c)>0)
bytes=lambda s:"".join(str([ord(c)for c in s]).replace(',','').replace(']','').replace('[',''))
dr_bytes=lambda s:"".join(str([(ord(c)-1)%9+1for c in s]).replace(',',' +').replace(']',' =').replace('[',''))
code="\n".join(stdin.readlines())
print(bytes(code))
print(dr_bytes(code), end=' ')
print(score(code))

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

PS: You could also look at my sad web app: https://thevortex.netlify.app/

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

Example program of how to calculate the Σ digit sum of your code:

from sys import stdin
score=lambda s:sum((ord(c)-1)%9+1for c in s if ord(c)>0)
bytes=lambda s:"".join(str([ord(c)for c in s]).replace(',','').replace(']','').replace('[',''))
dr_bytes=lambda s:"".join(str([(ord(c)-1)%9+1for c in s]).replace(',',' +').replace(']',' =').replace('[',''))
code="\n".join(stdin.readlines())
print(bytes(code))
print(dr_bytes(code), end=' ')
print(score(code))
deleted 27 characters in body
Source Link

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5 = 6 represented in base 10. Also look at digitDigit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

PS: You could also look at my sad web app: https://thevortex.netlify.app/

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5 = 6 represented in base 10. Also look at digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

PS: You could also look at my sad web app: https://thevortex.netlify.app/

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.

Input:

Given integers m and n which are the modular and multiplier for sequence.

Output:

Return all cyclic sequences of length greater than one for Digit roots of n * i in base m + 1.

  • \$1\$\$i\$\$m\$
  • \$1\$\$DR(n*i) \$\$m\$
  • \$DR(i) = i \$
  • \$DR(-m) = 0 \$
  • \$|DR(-x)| \equiv DR(x) \equiv -DR(x)\$ (mod \$ m) \$
  • \$DR(a+b) = DR(DR(a)+DR(b))\$
  • \$DR(a-b) \cong (DR(a)-DR(b))\$ (mod \$ m) \$

Example Input:

9 4

Example Output:

1 4 7
2 5 8

More details:

m=9, n=4
DR(4*1) -> 4
DR(4*4) -> 7
DR(4*7) -> 1 = first i

A cycle happens when going through numbers 1 trough m taking digit root of n * i and then digit root of n * result of previous call and so on until returns to the first i.

Note that if there is no cycle taking digit root of n * i would simply result to i.

So we store this sequence in something like a hash set for all the i's and then return all the sequences.

Challenge

All the normal rules are applied excepts the answer with smaller sum of digit roots of each individual byte wins.

PS: You could also look at my sad web app: https://thevortex.netlify.app/

deleted 9 characters in body
Source Link
Loading
added 11 characters in body
Source Link
Loading
added 177 characters in body
Source Link
Loading
deleted 1 character in body
Source Link
Loading
added 80 characters in body
Source Link
Loading
added 1 character in body
Source Link
Loading
added 1 character in body
Source Link
Loading
added 1 character in body
Source Link
Loading
added 4 characters in body
Source Link
Loading
added 27 characters in body; edited title
Source Link
Loading
deleted 5 characters in body
Source Link
Loading
edited tags
Link
rydwolf
  • 18.9k
  • 2
  • 83
  • 172
Loading
deleted 70 characters in body
Source Link
Loading
added 140 characters in body; edited tags
Source Link
Loading
Source Link
Loading