Skip to main content
Commonmark migration
Source Link

#05AB1E, 8 (or 10?) 11 (or 13?) bytes

05AB1E, 8 (or 10?) 11 (or 13?) bytes

Ÿʒ₄n+¦S3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes. This could however be fixed with 1 additional byte (12 bytes):

Ÿ₄n+€¦ʒS3ôOË

Try it online or verify some more test cases.

+3 bytes to bug-fix numbers with a length of 3 or less (range [000000, 000999]).

Explanation:

Ÿ          # Create an inclusive (on both sides) range from the two inputs
           #  i.e. 038920 and 038910 → 
           #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ         # Filter this list by:
  ₄n+      #  Add 1,000,000 to the number
     |     #  And remove the leading 1
           #   i.e. 38910 → 1038910 → '038910'
  S        #  Transform it to a list of digits
           #   i.e. '038910' → ['0','3','8','9','1','0']
   3ô      #  Split it into chunks of length 3
           #   i.e. ['0','3','8','9','1','0'] → [['0','3','8'],['9','1','0']]
     O     #  Sum the digits in both parts
           #   i.e. [['0','3','8'],['9','1','0']] → [11,10]
      Ë    #  Check if they are equal (if they are, they remain in the filtered list)
           #   i.e. [11,10] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a trailing }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 10 13 bytes instead:

Ÿʒ₄n+¦S3ôOË}g

Try it online or verify some more test cases.

#05AB1E, 8 (or 10?) 11 (or 13?) bytes

Ÿʒ₄n+¦S3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes. This could however be fixed with 1 additional byte (12 bytes):

Ÿ₄n+€¦ʒS3ôOË

Try it online or verify some more test cases.

+3 bytes to bug-fix numbers with a length of 3 or less (range [000000, 000999]).

Explanation:

Ÿ          # Create an inclusive (on both sides) range from the two inputs
           #  i.e. 038920 and 038910 → 
           #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ         # Filter this list by:
  ₄n+      #  Add 1,000,000 to the number
     |     #  And remove the leading 1
           #   i.e. 38910 → 1038910 → '038910'
  S        #  Transform it to a list of digits
           #   i.e. '038910' → ['0','3','8','9','1','0']
   3ô      #  Split it into chunks of length 3
           #   i.e. ['0','3','8','9','1','0'] → [['0','3','8'],['9','1','0']]
     O     #  Sum the digits in both parts
           #   i.e. [['0','3','8'],['9','1','0']] → [11,10]
      Ë    #  Check if they are equal (if they are, they remain in the filtered list)
           #   i.e. [11,10] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a trailing }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 10 13 bytes instead:

Ÿʒ₄n+¦S3ôOË}g

Try it online or verify some more test cases.

05AB1E, 8 (or 10?) 11 (or 13?) bytes

Ÿʒ₄n+¦S3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes. This could however be fixed with 1 additional byte (12 bytes):

Ÿ₄n+€¦ʒS3ôOË

Try it online or verify some more test cases.

+3 bytes to bug-fix numbers with a length of 3 or less (range [000000, 000999]).

Explanation:

Ÿ          # Create an inclusive (on both sides) range from the two inputs
           #  i.e. 038920 and 038910 → 
           #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ         # Filter this list by:
  ₄n+      #  Add 1,000,000 to the number
     |     #  And remove the leading 1
           #   i.e. 38910 → 1038910 → '038910'
  S        #  Transform it to a list of digits
           #   i.e. '038910' → ['0','3','8','9','1','0']
   3ô      #  Split it into chunks of length 3
           #   i.e. ['0','3','8','9','1','0'] → [['0','3','8'],['9','1','0']]
     O     #  Sum the digits in both parts
           #   i.e. [['0','3','8'],['9','1','0']] → [11,10]
      Ë    #  Check if they are equal (if they are, they remain in the filtered list)
           #   i.e. [11,10] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a trailing }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 10 13 bytes instead:

Ÿʒ₄n+¦S3ôOË}g

Try it online or verify some more test cases.

added 512 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#05AB1E, 88 (or 10?) 11 (or 1013?) bytes

ŸʒRS3ôOËŸʒ₄n+¦S3ôOË

Try it onlineTry it online or verify some more test casesverify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes. This could however be fixed with 1 additional byte (12 bytes):

Ÿ₄n+€¦ʒS3ôOË

Try it online or verify some more test cases.

+3 bytes to bug-fix numbers with a length of 3 or less (range [000000, 000999]).

Explanation:

Ÿ           # Create an inclusive (on both sides) range from the two inputs
            #  i.e. 038920 and 038910 → 
            #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ          # Filter this list by:
  R ₄n+      #  #Add 1,000,000 Reverseto the number 
 (the reverse is because the| numbers lack   #  And remove the leading zeroes)1
            #   i.e. 38910 → '01983'
1038910 → '038910'
  S        #  Transform it to a list of digits
            #   i.e. '01983''038910' → ['0','1''3','8','9','8''1','3']'0']
    3ô      #  Split it into chunks of length 3
            #   i.e. ['0','1''3','8','9','8''1','3']'0'] → [['0','1''3','9']'8'],['8'['9','3']]'1','0']]
      O     #  Sum the digits in both parts
            #   i.e. [['0','1''3','9']'8'],['8'['9','3']]'1','0']][10[11,11]10]
       Ë    #  Check if they are equal (if they are, they remain in the filtered list)
            #   i.e. [10[11,11]10] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a leadingtrailing }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 1010 13 bytes instead:

ŸʒRS3ôOËŸʒ₄n+¦S3ôOË}g

Try it onlineTry it online or verify some more test casesverify some more test cases.

#05AB1E, 8 (or 10?) bytes

ŸʒRS3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes.

Explanation:

Ÿ           # Create an inclusive (on both sides) range from the two inputs
            #  i.e. 038920 and 038910 → 
            #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ          # Filter this list by:
  R         #  Reverse the number (the reverse is because the numbers lack leading zeroes)
            #   i.e. 38910 → '01983'
   S        #  Transform it to a list of digits
            #   i.e. '01983' → ['0','1','9','8','3']
    3ô      #  Split it into chunks of length 3
            #   i.e. ['0','1','9','8','3'] → [['0','1','9'],['8','3']]
      O     #  Sum the digits in both parts
            #   i.e. [['0','1','9'],['8','3']][10,11]
       Ë    #  Check if they are equal (if they are, they remain in the filtered list)
            #   i.e. [10,11] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a leading }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 10 bytes instead:

ŸʒRS3ôOË}g

Try it online or verify some more test cases.

#05AB1E, 8 (or 10?) 11 (or 13?) bytes

Ÿʒ₄n+¦S3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes. This could however be fixed with 1 additional byte (12 bytes):

Ÿ₄n+€¦ʒS3ôOË

Try it online or verify some more test cases.

+3 bytes to bug-fix numbers with a length of 3 or less (range [000000, 000999]).

Explanation:

Ÿ          # Create an inclusive (on both sides) range from the two inputs
           #  i.e. 038920 and 038910 → 
           #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ         # Filter this list by:
  ₄n+      #  Add 1,000,000 to the number 
     |     #  And remove the leading 1
           #   i.e. 38910 → 1038910 → '038910'
  S        #  Transform it to a list of digits
           #   i.e. '038910' → ['0','3','8','9','1','0']
   3ô      #  Split it into chunks of length 3
           #   i.e. ['0','3','8','9','1','0'] → [['0','3','8'],['9','1','0']]
     O     #  Sum the digits in both parts
           #   i.e. [['0','3','8'],['9','1','0']][11,10]
      Ë    #  Check if they are equal (if they are, they remain in the filtered list)
           #   i.e. [11,10] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a trailing }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 10 13 bytes instead:

Ÿʒ₄n+¦S3ôOË}g

Try it online or verify some more test cases.

added 612 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

#05AB1E, 8 (or 10?) bytes

ŸʒRS3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes.

Explanation:

Ÿ           # Create an inclusive (on both sides) range from the two inputs
            #  i.e. 038920 and 038910 → 
            #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ          # Filter this list by:
  R         #  Reverse the number (the reverse is because the numbers lack leading zeroes)
            #   i.e. 38910 → '01983'
   S        #  Transform it to a list of digits
            #   i.e. '01983' → ['0','1','9','8','3']
    3ô      #  Split it into chunks of length 3
            #   i.e. ['0','1','9','8','3'] → [['0','1','9'],['8','3']]
      O     #  Sum the digits in both parts
            #   i.e. [['0','1','9'],['8','3']] → [10,11]
       Ë    #  Check if they are equal (if they are, they remain in the filtered list)
            #   i.e. [10,11] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a leading }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 10 bytes instead:

ŸʒRS3ôOË}g

Try it online or verify some more test cases.

#05AB1E, 8 bytes

ŸʒRS3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes.

Explanation:

Ÿ           # Create an inclusive (on both sides) range from the two inputs
            #  i.e. 038920 and 038910 → 
            #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ          # Filter this list by:
  R         #  Reverse the number (the reverse is because the numbers lack leading zeroes)
            #   i.e. 38910 → '01983'
   S        #  Transform it to a list of digits
            #   i.e. '01983' → ['0','1','9','8','3']
    3ô      #  Split it into chunks of length 3
            #   i.e. ['0','1','9','8','3'] → [['0','1','9'],['8','3']]
      O     #  Sum the digits in both parts
            #   i.e. [['0','1','9'],['8','3']] → [10,11]
       Ë    #  Check if they are equal (if they are, they remain in the filtered list)
            #   i.e. [10,11] → 0

#05AB1E, 8 (or 10?) bytes

ŸʒRS3ôOË

Try it online or verify some more test cases.

NOTE: In 05AB1E strings and integers are interchangeable, so the output numbers doesn't contain leading zeroes.

Explanation:

Ÿ           # Create an inclusive (on both sides) range from the two inputs
            #  i.e. 038920 and 038910 → 
            #   [38910,38911,38912,38913,38914,38915,38916,38917,38918,38919,38920]
 ʒ          # Filter this list by:
  R         #  Reverse the number (the reverse is because the numbers lack leading zeroes)
            #   i.e. 38910 → '01983'
   S        #  Transform it to a list of digits
            #   i.e. '01983' → ['0','1','9','8','3']
    3ô      #  Split it into chunks of length 3
            #   i.e. ['0','1','9','8','3'] → [['0','1','9'],['8','3']]
      O     #  Sum the digits in both parts
            #   i.e. [['0','1','9'],['8','3']] → [10,11]
       Ë    #  Check if they are equal (if they are, they remain in the filtered list)
            #   i.e. [10,11] → 0

EDIT: Seems I (and most other answers) slightly misread the challenge and the amount of numbers is being asked instead of the numbers themselves within the range. In that case a leading }g can be added (close the filter; and get the amount of numbers left in the filtered list), so it's 10 bytes instead:

ŸʒRS3ôOË}g

Try it online or verify some more test cases.

Added highlighting
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384
Loading