总和链序列


16

顺序:

  1. 我们从开始1
  2. 我们首先将当前的1索引值添加到序列中的前一个数字。
  3. 然后,如果它们适用于此当前值,则按顺序应用以下数学运算:
    • 可除以2?=>加法
    • 可除以3?=>减法
    • 可除以4?=>(加和)相乘
    • 不是没有除尽23也没有4?->继续当前的总和结果

输出:

按以下顺序输出前100个数字:

1, 1, 21, 25, 30, 216, 223, 223, 2169, 2179, 2190, 2202, 2215, 2215, 2245, 2261, 2295, 2295, 2333, 2353, 2395, 2417, 56649, 56649, 56699, 56725, 1533033, 1533061, 1533090, 45993600, 45993631, 45993631, 1517792001, 1517792035, 1517792070, 1517792106, 1517792143, 1517792143, 1517792221, 1517792261, 1517792343, 1517792343, 1517792429, 1517792473, 1517792563, 1517792609, 71336257041, 71336257041, 71336257139, 71336257189, 3638149121841, 3638149121893, 3638149121946, 196460052588000, 196460052588055, 196460052588055, 11198222997525633, 11198222997525691, 11198222997525750, 11198222997525810, 11198222997525871, 11198222997525871, 11198222997525997, 11198222997526061, 11198222997526191, 11198222997526191, 11198222997526325, 11198222997526393, 11198222997526531, 11198222997526601, 795073832824398753, 795073832824398753, 795073832824398899, 795073832824398973, 59630537461829934225, 59630537461829934301, 59630537461829934378, 4651181922022734887568, 4651181922022734887647, 4651181922022734887647, 376745735683841525912529, 376745735683841525912611, 376745735683841525912694, 376745735683841525912778, 376745735683841525912863, 376745735683841525912863, 376745735683841525913037, 376745735683841525913125, 376745735683841525913303, 376745735683841525913303, 376745735683841525913485, 376745735683841525913577, 376745735683841525913763, 376745735683841525913857, 35790844889964944961834465, 35790844889964944961834465, 35790844889964944961834659, 35790844889964944961834757, 3543293644106529551221660545, 3543293644106529551221660645

以下是序列中的前10个数字,并附有说明:

// Starting number of the sequence:
1

// 1 (previous number in the sequence)
// + 2 (current index in 1-indexed sequence)
// = 3 -> 3 - 2 (3 is divisible by 3, so we subtract the current index 2)
// = 1
1

// 1 (previous number in the sequence)
// + 3 (current index in 1-indexed sequence)
// = 4 -> 4 + 3 (4 is divisible by 2, so we first add the current index 3)
// = 7 -> 7 * 3 (and 4 is also divisible by 4, so we then also multiply the current index 3)
// = 21
21

// 21 (previous number in the sequence)
// + 4 (current index in 1-indexed sequence)
// = 25 (25 is not divisible by 2, 3 nor 4)
25

// 25 (previous number in the sequence)
// + 5 (current index in 1-indexed sequence)
// = 30 -> 30 + 5 (30 is divisible by 2, so we first add the current index 5)
// = 35 -> 35 - 5 (and 30 is also divisible by 3, so we then also subtract the current index 5)
// = 30
30

// 30 (previous number in the sequence)
// + 6 (current index in 1-indexed sequence)
// = 36 -> 36 + 6 (36 is divisible by 2, so we first add the current index 6)
// = 42 -> 42 - 6 (and 36 is also divisible by 3, so we then also subtract the current index 6)
// = 36 -> 36 * 6 (and 36 is also divisible by 4, so we then also multiply the current index 6)
// = 216
216

// 216 (previous number in the sequence)
// + 7 (current index in 1-indexed sequence)
// = 223 (223 is not divisible by 2, 3 nor 4)
223

// 223 (previous number in the sequence)
// + 8 (current index in 1-indexed sequence)
// = 231 -> 231 - 8 (231 is divisible by 3, so we subtract the current index 8)
// = 223
223

// 223 (previous number in the sequence)
// + 9 (current index in 1-indexed sequence)
// = 232 -> 232 + 9 (232 is divisible by 2, so we first add the current index 9)
// = 241 -> 241 * 9 (and 232 is also divisible by 4, so we then also multiply the current index 9)
// = 2169
2169

// 2169 (previous number in the sequence)
// + 10 (current index in 1-indexed sequence)
// 2179 (2179 is not divisible by 2, 3 nor 4)
2179

挑战规则:

  • 如果您的语言不支持大于2 31 -1的语言,则可以继续执行该序列,直到达到该最大值(即前46个数字,直到-并包括- 1,517,792,609)。
  • 输出格式灵活。您可以返回一个数组或列表,一个用空格,逗号等分隔的字符串。您的呼叫。

通用规则:

  • 这是,因此最短答案以字节为单位。
    不要让代码高尔夫球语言阻止您使用非代码高尔夫球语言发布答案。尝试针对“任何”编程语言提出尽可能简短的答案。
  • 标准规则适用于您的答案,因此允许您使用STDIN / STDOUT,具有适当参数的函数/方法,完整程序。你的来电。
  • 默认漏洞是禁止的。
  • 如果可能的话,请添加一个带有测试代码的链接。
  • 另外,如有必要,请添加说明。

我们是输出第n个值,还是前n个值,还是直到输出最大整数?
加布里埃尔·贝纳米

@GabrielBenamy序列中的前100个。
凯文·克鲁伊森

1
我很确定您在该区块中只有99个数字。
卡德,2013年

2
我的回答与您仅输出的最后13个数字不同。
加布里埃尔·贝纳米

1
@Shebang修复..对不起,开始马虎..它已经在沙箱中存放了5天,但我想我和其他人都没有注意到它。:S现在应该是正确的。
凯文·克鲁伊森

Answers:


1

05AB1E24 23字节

-1字节感谢Kevin Crujissen

¼¾тF=¼¾+©…+-*v®NÌÖi¾y.V

在线尝试!

说明:

¼¾                        # set the counter to 1, then push 1
  тF                      # repeat the following 100 times
    =                     # print the current number in the sequence
     ¼¾                   # increment the counter
       +                  # add it to the current number
        ©                 # save the result in the register
         …+-*v            # for each of '+', '-', and '*'...
              ®   i       # if the register...
                 Ö        # is divisible by...
               NÌ         # the loop index + 2...
                   ¾y.V   # then apply the current operation

1
试图找到与计数器变量较短的东西,以便UX可以将其删除,但我无法。我也以24个字节结尾,因为它以0而不是开头1。我现在在一段时间之前增加了它,但是然后我们不得不循环101时间而不是100..嗯。
凯文·克鲁伊森

@KevinCruijssen是的,这UX很麻烦。我试图摆脱它一段时间,最后得到了24和25个变化:1тF=NÌ©+DÑ3L>Ãv®…-*+yè.V1тL>v=y+©3F®NÌÖiy…+-*Nè.V...我没有考虑使用counter变量,这很有趣。
Grimmy

1
@KevinCruijssen您的24启发了23:只需使用тF代替即可Ƶ0µ。我已经对其进行了编辑,谢谢!(PS:确实应该有一个单字节¼¾...)
Grimmy

很好。想着你会找到某种方式,哈哈。;)是的,一个单独的比较¼¾好,尽管说实话,我几乎从来没有那样使用它。我现在最喜欢的单字节内置是第二个©®不会弹出的变量。也许从一个空字符串开始,""就像您在之前另一个挑战中提到的那样。
凯文·克鲁伊森

8

R,85 82 79 76 72 70字节

for(i in 2:56)T[i]=((z=i+T[i-1])+i*(!z%%2)-i*(!z%%3))*`if`(z%%4,1,i);T

松散

s=1 ## formerly s=1:56, formerly s=1:100
for(i in 2:56){
    z=i+s[i-1]
    s[i]=(z+i*(z%%2<1)-i*(z%%3<1))*(1+(i-1)*(z%%4<1))
}
s

感谢@rturnbull指出,我可以使用(!z%%3)而不是(z%%3<1)检查模数,并且可以定义z首次使用时发生的情况。

通过滥用向量扩展游走了3-4个字符:答案最初是开始的,s=1:56...但我们不需要这样做,长度s会根据需要扩展。

通过使用"if"函数调用替换最后一个条件,又节省了3个字节(是的,这是R中的适当功能!)

通过替换sT,还节省了4个字节,后者是的内置TRUE值,也等于1。我在与@rturnbull的同时意识到了(诚实!)

一旦超过2 ^ 52,这确实会遇到一些数字问题,但是我无能为力-R只能double对大于的数字使用类型2^31-1,但它们存储的整数最大为2 ^ 52。因此,只允许输出前56个术语(最后一个术语为“正确”),这在100长度的情况下节省了一个字节。

这是56长度版本的输出:

    > for(i in 2:56){z=i+T[i-1];T[i]=(z+i*(!z%%2)-i*(!z%%3))*`if`(z%%4,1,i)};T
 [1]               1               1              21              25              30             216
 [7]             223             223            2169            2179            2190            2202
[13]            2215            2215            2245            2261            2295            2295
[19]            2333            2353            2395            2417           56649           56649
[25]           56699           56725         1533033         1533061         1533090        45993600
[31]        45993631        45993631      1517792001      1517792035      1517792070      1517792106
[37]      1517792143      1517792143      1517792221      1517792261      1517792343      1517792343
[43]      1517792429      1517792473      1517792563      1517792609     71336257041     71336257041
[49]     71336257139     71336257189   3638149121841   3638149121893   3638149121946 196460052588000
[55] 196460052588055 196460052588055

1
考虑到挑战的描述,我只能说最多循环56次是公平的游戏。
Billywob

@Billywob确实是正确的。在描述中,我声明“ 如果您的语言不支持大于2 ^ 31-1的语言,则可以继续执行该序列,直到达到最大值(因此前46个数字,直到-包括-为止1,517,792,609)。 ”当然也适用于不同于32位的数字。如果R无法处理更大的值,则比前56个数字还好。是的,如果你知道它永远不会去上面56,你可以改变100,以56挽救一个字节。
凯文·克鲁伊森

1
您可以通过将更改为z%%2<1(以此类推)来保存三个字节,以免!z%%2滥用隐式类型转换。
rturnbull

感谢@rturnbull,出于某种原因我以为!没有打败%%,但显然可以!
JDL

2
您也可以滥用T和使用它代替s,从而允许删除s=1;,从而节省另外四个字节。可以像这样z将的定义折叠成s[i]T[i]现在)的定义:T[i]=((z=i+T[i-1])+ ...,这意味着您可以丢失大括号,从而节省更多字节。编辑:哦,我看到您T在写我的评论时成功了!他们说,有头脑的人会这样认为。
rturnbull

5

Python 3,82 78 76 74 72字节

i=s=1
exec('print(s);i+=1;s+=i;s=(s+i-i*(s%2+(s%3<1)))*i**(s%4<1);'*100)

输出:

1
1
21
25
30
216
223
223
2169
2179
2190
2202
2215
2215
2245
2261
2295
2295
2333
2353
2395
2417
56649
56649
56699
56725
1533033
1533061
1533090
45993600
45993631
45993631
1517792001
1517792035
1517792070
1517792106
1517792143
1517792143
1517792221
1517792261
1517792343
1517792343
1517792429
1517792473
1517792563
1517792609
71336257041
71336257041
71336257139
71336257189
3638149121841
3638149121893
3638149121946
196460052588000
196460052588055
196460052588055
11198222997525633
11198222997525691
11198222997525750
11198222997525810
11198222997525871
11198222997525871
11198222997525997
11198222997526061
11198222997526191
11198222997526191
11198222997526325
11198222997526393
11198222997526531
11198222997526601
795073832824398753
795073832824398753
795073832824398899
795073832824398973
59630537461829934225
59630537461829934301
59630537461829934378
4651181922022734887568
4651181922022734887647
4651181922022734887647
376745735683841525912529
376745735683841525912611
376745735683841525912694
376745735683841525912778
376745735683841525912863
376745735683841525912863
376745735683841525913037
376745735683841525913125
376745735683841525913303
376745735683841525913303
376745735683841525913485
376745735683841525913577
376745735683841525913763
376745735683841525913857
35790844889964944961834465
35790844889964944961834465
35790844889964944961834659
35790844889964944961834757
3543293644106529551221660545
3543293644106529551221660645

欢迎提出建议!



4

05AB1E34 31 30字节

XTnFD,NÌ©+D3L>%_`X®‚sèrŠs-®*+*

在线尝试!

说明

X                               # initialize stack with 1
 TnF                            # for N in [0 ... 99]
    D,                          # print a copy of top of stack
      NÌ©                       # increase index N by 2 and store in register
         +                      # add this to current value
          D                     # make a copy of the current value
           3L>                  # push the list [2,3,4]
              %                 # take current value mod elements in list
               _                # invert this
                `               # push the elements from the list to stack
                 X®‚sè          # index into list [1,N+2] with the result of mod 4
                      rŠs-      # subtract result of mod 3 from result of mod 2
                          ®*    # multiply by N+2
                            +   # add this to current value
                             *  # multiply current value with the result from index operation

3

Python 2,76字节

很标准的实现,我认为使用exec语句而不是while循环可以节省2个字节左右。递归方法可能更短,我想xnor很快就会弹出;)

n=1
f=1
exec'print f;n+=1;d=f+n;f=(d+n*(d%2<1)-n*(d%3<1))*[1,n][d%4<1];'*100

如果使用TheNumberOne找出的更新,则将使用69个字节(但随后将进行复制)

n=f=1;exec'print f;n+=1;d=f+n;f=(d+n-n*(d%2+(d%3<1))*n**(d%4<1);'*100

输出:

1
1
21
25
30
216
223
223
2169
2179
2190
2202
2215
2215
2245
2261
2295
2295
2333
2353
2395
2417
56649
56649
56699
56725
1533033
1533061
1533090
45993600
45993631
45993631
1517792001
1517792035
1517792070
1517792106
1517792143
1517792143
1517792221
1517792261
1517792343
1517792343
1517792429
1517792473
1517792563
1517792609
71336257041
71336257041
71336257139
71336257189
3638149121841
3638149121893
3638149121946
196460052588000
196460052588055
196460052588055
11198222997525633
11198222997525691
11198222997525750
11198222997525810
11198222997525871
11198222997525871
11198222997525997
11198222997526061
11198222997526191
11198222997526191
11198222997526325
11198222997526393
11198222997526531
11198222997526601
795073832824398753
795073832824398753
795073832824398899
795073832824398973
59630537461829934225
59630537461829934301
59630537461829934378
4651181922022734887568
4651181922022734887647
4651181922022734887647
376745735683841525912529
376745735683841525912611
376745735683841525912694
376745735683841525912778
376745735683841525912863
376745735683841525912863
376745735683841525913037
376745735683841525913125
376745735683841525913303
376745735683841525913303
376745735683841525913485
376745735683841525913577
376745735683841525913763
376745735683841525913857
35790844889964944961834465
35790844889964944961834465
35790844889964944961834659
35790844889964944961834757
3543293644106529551221660545
3543293644106529551221660645

3

JavaScript,75 63字节

for(n=p=0;n++<57;alert(p=p%4?q:q*n))q=(p+=n)%2?p:p+n,q-=p%3?0:n

另一个版本:

for(n=p=0;n++<57;)alert(p=((p+=n)+(!(p%2)-!(p%3))*n)*(p%4?1:n))

两者都停止在索引57(索引为0),因为那是输出超过JavaScript的安全数字大小(2 53-1)。事实证明,即使使用ES6,循环也比递归函数短:

f=(n=0,p=0)=>n++>56?[]:(q=(p+=n)%2?p:p+n,q-=p%3?0:n,[q*=p%4?1:n,...f(n,q)])

这个返回前57个元素的数组。


我认为您应该避免超过〜50-60,因为这样会超过Number.MAX_SAFE_INTEGER,这样您的划分将变得不正确。我还尝试了该map版本的完整性,它的时钟也为75字节。
尼尔

@尼尔,谢谢。确切地说,在57个条目之后,它超过了Number.MAX_SAFE_INTEGER。
ETHproductions

3

脑高射炮 476 466 462 456 446个字节

通过Wheat Wizard节省了6个字节

(((((((())<>()(())()){}){}){}())){}{}){({}[()]<(((({})<>({}())<>))<({}(()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}{(<{}({}<>({})<>)>)}{}>)(({})<({}(()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}{(<{}({}<>[({})]<>)>)}{}>)({}(()()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}{(<{}(<>({}))({<({}[()])><>({})<>}{}<><{}>)>)}{}>)}{}

在线尝试!

这真的很慢。TIO无法处理全部100个数字(限制似乎是22或23)。因此,此示例仅生成前20个,但该代码也适用于100个。

简要说明:

      (())<>                           # push a 1 (the index) and switch stacks 
            (())                       # then push a 1 (the starting number)
((((((          ()()){}){}){}())){}{}) # and a 99 (a counter so that we only print the 
                                       # first 100 numbers)

# repeat until the counter is 0
{
  # pop the counter and push it minus 1 after:
  ({}[()]<
    # hold onto the current number plus the index (leave a copy on the stack to be printed)
    # and increment the index
    (((({})<>({}())<>))<
      # push logical not of (current mod 2)
      ({}(()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}
      # if !(current mod 2) is 1, add the index
      {(<{}({}<>({})<>)>)}{}
    # push the current number back on
    >)
    # hold onto the current number
    (({})<
     # push logical not of (current mod 3)
     ({}(()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}
     # if !(current mod 3) is 1, then subtract the index
     {(<{}({}<>[({})]<>)>)}{}
    # push the current number back on
    >)
    # push logical not of (current mod 4)
    ({}(()()()())(<()>)){({}[()]<(({}()[({})])){{}(<({}({}))>)}{}>)}({}{}<{}(())>){((<{}{}>))}{}
    # if !(current mod 4) is 1, multiply by the index
    {(<{}(<>({}))({<({}[()])><>({})<>}{}<><{}>)>)}{}
  # put the counter back on
  >)
# loop until done
}
# pop the counter
{}

({}<>[({})]<>)(<()>)可以替换为(<({}<>[({})]<>)>)
岩礁猎人

@WheatWizard更新。谢谢!
莱利

1

Java 7,316字节

import java.math.*;String c(){String r="";BigInteger t=BigInteger.ONE,x,p;for(int i=2;i<102;){r+=t+" ";p=(t=t.add(x=new BigInteger(i+++"")));t=x(p,2)?t.add(x):t;t=x(p,3)?t.subtract(x):t;t=x(p,4)?t.multiply(x):t;}return r;}boolean x(BigInteger p,int i){return p.mod(new BigInteger(i+"")).compareTo(BigInteger.ONE)<0;}

取消测试代码:

在这里尝试。

import java.math.*;
class M{
  static String c(){
    String r = "";
    BigInteger t = BigInteger.ONE,
               x,
               p;
    for(int i = 2; i < 102;){
      r += t+" ";
      p = (t = t.add(x = new BigInteger(i++ + "")));
      t = x(p, 2)
           ? t.add(x)
           : t;
      t = x(p, 3)
           ? t.subtract(x)
           : t;
      t = x(p, 4)
           ? t.multiply(x)
           : t;
    }
    return r;
  }

  public static void main(String[] a){
    System.out.println(c());
  }

  static boolean x(BigInteger p, int i){
    return p.mod(new BigInteger(i+"")).compareTo(BigInteger.ONE) < 0;
  }
}

输出:

1 1 21 25 30 216 223 223 2169 2179 2190 2202 2215 2215 2245 2261 2295 2295 2333 2353 2395 2417 56649 56649 56699 56725 1533033 1533061 1533090 45993600 45993631 45993631 1517792001 1517792035 1517792070 1517792106 1517792143 1517792143 1517792221 1517792261 1517792343 1517792343 1517792429 1517792473 1517792563 1517792609 71336257041 3424140340272 3424140340321 3424140340371 3424140340473 3424140340525 3424140340631 3424140340631 3424140340741 3424140340797 3424140340911 3424140340969 202024280124133 202024280124193 202024280124315 202024280124377 12727529647843689 814561897462000192 52946523335030016705 52946523335030016771 52946523335030016905 52946523335030016973 52946523335030017111 52946523335030017111 52946523335030017253 52946523335030017253 52946523335030017399 52946523335030017473 3970989250127251321725 301795183009671100456876 301795183009671100456953 301795183009671100457031 301795183009671100457110 301795183009671100457270 301795183009671100457351 301795183009671100457433 25049000189802701337980717 25049000189802701337980801 25049000189802701337980971 25049000189802701337981057 2179263016512835016404367097 191775145453129481443584312280 17067987945328523848479003800841 1536118915079567146363110342083790 1536118915079567146363110342083790 1536118915079567146363110342083974 1536118915079567146363110342083974 144395178017479311758132372155911228 13717541911660534617022575354811575685 13717541911660534617022575354811575781 13717541911660534617022575354811575975 13717541911660534617022575354811576073 1358036649254392927085234960126346050829 

1

C#,120字节

就像没有理智的人会在Java中打高尔夫球一样,理智的人也不会在C#中打高尔夫球!但是搞砸了,我想看看我能做什么。该1M铸件f要具有足够的精度对这个答案,而不必写我一个小数decimal。同样,就地递增会在我的Python答案上节省一些字节。最后,它仍然长了50个字节。

void k(){int n=1;var f=1M;while(n<101){Console.WriteLine(f);var d=++n+f;f=(d+n*((d%2<1?1:0)-(d%3<1?1:0)))*(d%4<1?n:1);}}

这是更易读(可运行)的版本:

using System;
class P
{
    static void Main(string[]a) 
    {
        int n = 1;
        var f = 1M;
        while (n < 101) 
        {
            Console.WriteLine(f);
            var d = ++n + f;
            f = (d + n * ((d % 2 < 1 ? 1 : 0) - (d % 3 < 1 ? 1 : 0))) * (d % 4 < 1 ? n : 1);
        }
        Console.Read();
    }
}

您可以通过更改whileto for并插入int 来打高尔夫球1个字节,如下所示:for(int n=1;n<101;)
Kevin Cruijssen

您甚至可以像这样打高尔夫球:void k(){for(decimal f=1,d,n=1;n<101;)Console.WriteLine(f=((d=++n+f)+n*((d%2<1?1:0)-(d%3<1?1:0)))*(d%4<1?n:1));}112字节
凯文·克鲁伊森

1

批处理,110字节

@set n=0
@for /l %%i in (1,1,46)do @set/an=((n+=%%i)+(!(n%%2)-!(n%%3))*%%i)*(~-%%i*!(n%%4)+1)&call echo %%n%%

使用@ETHproductions的公式,但略微调整了一点,因为Batch没有?:。批处理使用32位带符号整数,因此循环在46处停止。


1

Perl,75字节

use bigint;$a+=$_,say$a=($a+($a%2?0:$_)-($a%3?0:$_))*($a%4?1:$_)for(1..100)

该代码在新行上输出每个值,并计算所有100个值。


-Mbigint,则不要用括号括起来1..100,而!($a%2)*$_不是($a%2?0:$_)(与相同a%3..)应节省一些字节;)
Dada

通过这些建议和一些其他信息,将其压缩到60个字节
Xcali

1

Haskell,70 64字节

a%b=0^mod a b
n#i|s<-n+i=(s+s%2*i-s%3*i)*i^s%4
scanl1(#)[1..100]

scanl1(#)[1..100]返回带有前100个元素的列表。如果我可以停留在2 ^ 31范围(-> [1..46]),则少一个字节。

scanl1就像foldl1但将中间结果收集在列表中。可分性测试是通过helper函数完成的,该函数%0^0 = 1被整除或返回整除0^x = 0


1

J,46个字节

(,{:((]^0=4|+)*(]*0=2|+)++-]*0=3|+)1+#)^:99]1x

应用挑战中描述的方法。

用法

extra命令(,.~#\)用于将索引添加到每个值。

   (,.~#\) (,{:((]^0=4|+)*(]*0=2|+)++-]*0=3|+)1+#)^:99]1x
  1                            1
  2                            1
  3                           21
  4                           25
  5                           30
  6                          216
  7                          223
  8                          223
  9                         2169
 10                         2179
 11                         2190
 12                         2202
 13                         2215
 14                         2215
 15                         2245
 16                         2261
 17                         2295
 18                         2295
 19                         2333
 20                         2353
 21                         2395
 22                         2417
 23                        56649
 24                        56649
 25                        56699
 26                        56725
 27                      1533033
 28                      1533061
 29                      1533090
 30                     45993600
 31                     45993631
 32                     45993631
 33                   1517792001
 34                   1517792035
 35                   1517792070
 36                   1517792106
 37                   1517792143
 38                   1517792143
 39                   1517792221
 40                   1517792261
 41                   1517792343
 42                   1517792343
 43                   1517792429
 44                   1517792473
 45                   1517792563
 46                   1517792609
 47                  71336257041
 48                  71336257041
 49                  71336257139
 50                  71336257189
 51                3638149121841
 52                3638149121893
 53                3638149121946
 54              196460052588000
 55              196460052588055
 56              196460052588055
 57            11198222997525633
 58            11198222997525691
 59            11198222997525750
 60            11198222997525810
 61            11198222997525871
 62            11198222997525871
 63            11198222997525997
 64            11198222997526061
 65            11198222997526191
 66            11198222997526191
 67            11198222997526325
 68            11198222997526393
 69            11198222997526531
 70            11198222997526601
 71           795073832824398753
 72           795073832824398753
 73           795073832824398899
 74           795073832824398973
 75         59630537461829934225
 76         59630537461829934301
 77         59630537461829934378
 78       4651181922022734887568
 79       4651181922022734887647
 80       4651181922022734887647
 81     376745735683841525912529
 82     376745735683841525912611
 83     376745735683841525912694
 84     376745735683841525912778
 85     376745735683841525912863
 86     376745735683841525912863
 87     376745735683841525913037
 88     376745735683841525913125
 89     376745735683841525913303
 90     376745735683841525913303
 91     376745735683841525913485
 92     376745735683841525913577
 93     376745735683841525913763
 94     376745735683841525913857
 95   35790844889964944961834465
 96   35790844889964944961834465
 97   35790844889964944961834659
 98   35790844889964944961834757
 99 3543293644106529551221660545
100 3543293644106529551221660645

1

Perl 6,62个字节

1,{((my \v=$_+my \n=++$+1)+n*(v%%2-v%%3))*(v%%4*n||1)}.../645/

在线尝试!

实际上,我必须努力使我的字节数低于其他非高尔夫语言解决方案的字节数。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.