Skip to main content
Added example of it running.
Source Link
zgrep
  • 1.6k
  • 8
  • 9

k, 33 bytes

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}

Brief (python-ish) explanation:

{                                } / function(x):
                             1+!x  /   array from 1 to x, inclusive
                            '      /   for y in array:
        {                  }       /     function(y):
         (#$x;4;8)                 /       yield [ len(str(y), 4, 8 ][
                  +/~3 5!'x        /         sum([not(y mod 3), not(y mod 5)])
                                   /       ]
      +\                           /   cumulative sum of result of for loop
 1+&x=                             /   get index of x in cumulative sum, add one

Example using kmac 2016.06.28:

 f:{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}
 ,/f'1 6 15 313 3677
1 3 6 100 1001

k, 33 bytes

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}

k, 33 bytes

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}

Brief (python-ish) explanation:

{                                } / function(x):
                             1+!x  /   array from 1 to x, inclusive
                            '      /   for y in array:
        {                  }       /     function(y):
         (#$x;4;8)                 /       yield [ len(str(y), 4, 8 ][
                  +/~3 5!'x        /         sum([not(y mod 3), not(y mod 5)])
                                   /       ]
      +\                           /   cumulative sum of result of for loop
 1+&x=                             /   get index of x in cumulative sum, add one

Example using kmac 2016.06.28:

 f:{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}
 ,/f'1 6 15 313 3677
1 3 6 100 1001
deleted 2 characters in body
Source Link
Business Cat
  • 9.2k
  • 1
  • 17
  • 37

k, 33 bytes

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}

k, 33 bytes

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}

k, 33 bytes

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}
Source Link
zgrep
  • 1.6k
  • 8
  • 9

k, 33 bytes

{1+&x=+\{(#$x;4;8)+/~3 5!'x}'1+!x}