"we start from B2, if mod(B2 - B3) < 0.404 we delete A3B3 and continue to compare B2 with B(i), if B2 - B(i) >= 0.404 we leave this element (A(i)B(i)) fixed on it and similarly move down the table."
Assuming that mod(B2 - B3) means abs(B2 - B3), try this:
if abs(c(ii+1,2) - c(ii,2)) < d
disp(c)
0 874
2 2.11720602320851
0.735871743486974 2.5217086702088
1.74869739478958 2.92603749911282
0 856
2 3.19165165021604
1.025250501002 3.60216524206979
0.606412825651303 4.00667273307903
0 616
2 4.28115304395541
1.19659318637275 4.69862662310897
0 10948
2 5.30183213946769
1.23466933867735 5.71142154466949
0.758806656795153 6.12424849699399
1.52785571142285 6.54751942633208
1.02905811623246 6.95179358048678
0.914829659318637 7.35859538449461
1.29178356713427 7.77727534261792
0.92625250501002 8.18695170418768
1.04809619238477 8.59161482076668
1.16993987975952 9.00287568951791
0.861523046092184 9.42260601546063
1.39839679358717 9.84693292817287
1.04809619238477 10.2660423858507
0.899599198396794 10.6736981990686
1.25751503006012 11.0988268144203
0.983366733466934 11.5306047839989
1.12044088176353 11.9405803321538
1.15470941883768 12.3644081154567
0.941482965931864 12.7700285522133
1.26132264529058 13.1824258788438
1.11672442693585 13.5871743486974
0.930060120240481 13.9940950951889
1.25751503006012 14.4027438765563
1.04428857715431 14.8356388729866
1.0937875751503 15.254307702293
1.16993987975952 15.6767352082544
0.983366733466934 16.1191624981288
1.26132264529058 16.532959652051
1.08997995991984 16.968021737327
0.895791583166333 17.3930555795949
1.19659318637275 17.8138166305903
1.0062124248497 18.2242239250233
0.834869739478958 18.6440431940055
1.14328657314629 19.0668192290107
0.966024708224667 19.4789579158317
1.25751503006012 19.918643485359
1.08997995991984 20.3417004366163
0.92625250501002 20.7712950829121
1.16993987975952 21.1909957415409
1.00240480961924 21.623556697683
0.895791583166333 22.0276739096574
1.11663326653307 22.4685053121419
0.964328657314629 22.9103320066389
1.0062124248497 23.3167229726902
1.06713426853707 23.7654337458429
0.926573488501555 24.1923847695391
1.16993987975952 24.6259473928065
1.025250501002 25.0494707980332
1.04809619238477 25.4617561719141
1.11663326653307 25.9019697726354
0.983366733466934 26.3307434079025
1.12044088176353 26.7383853665268
1.04428857715431 27.2058786899506
0.933867735470942 27.6104368405056
1.08997995991984 28.0492051458027
0.964328657314629 28.5037771185699
0.865330661322645 28.9151904635095
1.04428857715431 29.3566776886207
0.92625250501002 29.817530567361
1.11663326653307 30.255651454339
1.00275821122773 30.6733466933868
0.914829659318637 31.084455603783
1.08997995991984 31.4973236701083
0.983366733466934 31.9119360899277
0.96813627254509 32.3173749243314
1.06332665330661 32.7245914894093
0.964328657314629 33.1752899720655
1.07094188376754 33.5840167168353
1.02784888051695 34.0120240480962
0.949098196392785 34.4208753183793
1.11663326653307 34.8253168145223
1.00240480961924 35.2851770526269
1.04809619238477 35.6925755300022
1.06713426853707 36.1407554668142
0.966925311777651 36.565130260521
1.14328657314629 37.0106338554092
1.025250501002 37.4817508610529
0.92625250501002 37.9067206790402
1.0900579495055 38.3326653306613
1.00240480961924 38.744435754514
0.914829659318637 39.1497351538883
1.05571142284569 39.5569420415063
0.983366733466934 39.9963005507543
1.14328657314629 40.4188366849905
1.04428857715431 40.8312846529885
0.945859483074498 41.2785571142285
1.08997995991984 41.7427463263307
1.00240480961924 42.2032788002544
1.07094188376754 42.6084113896733
1.04597387311875 43.0460921843687
0.983366733466934 43.4654662422508
1.11663326653307 43.8926681444734
1.025250501002 44.355437745534
1.12044088176353 44.7707013459511
1.06941275384993 45.2064128256513
1.00240480961924 45.6294741280088
1.0937875751503 46.0477343225803
1.04428857715431 46.5577921031761
0.964328657314629 46.9736982293634
1.02905811623246 47.4438977350823
1.0062124248497 47.8489122575484
0.990981963927856 48.310035972897
0.974595181859493 48.7414829659319
0.960521042084168 49.2155663525613
0.983366733466934 49.706265476134
0.922048215372188 50.1162324649299
1.04428857715431 50.5532597492978
0.964328657314629 50.9990572316938
0.895791583166333 51.428252072188
1.00348014749607 51.8837675350701
0.92625250501002 52.3933692915681
0.987174348697395 52.8233630473498
0.966958323561267 53.2585170340681
0.911022044088176 53.6710893026631
1.01763527054108 54.0895052576459
0.945290581162325 54.6039531309095
1.02905811623246 55.0098753620867
0.983865259161301 55.4188376753507
0.92625250501002 55.8921196301644
1.025250501002 56.327795823501
0.946869038498476 56.7935871743487
0.911022044088176 57.2110538302644
0.983366733466934 57.7439395610648
0.913357161534123 58.1683366733467
1.025250501002 58.6117979094731
0.964328657314629 59.0581812806355
1.0062124248497 59.4762996704228
1.00240480961924 59.9110232893609
0.945290581162325 60.3170212113234
1.04686835650093 60.7214428857715
0.983366733466934 61.2132687696425
0.911381518657846 61.7034068136273
1.00240480961924 62.209068724539
0.945290581162325 62.6681225279227
1.02905811623246 63.0760429146227
0.983366733466934 63.5080916671845
0.92625250501002 63.9182106233393
1.0062124248497 64.3413731844444
0.964328657314629 64.8274482797271
1.04641047986553 65.2384769539078
0.983366733466934 65.7096155814402
0.945290581162325 66.1285446557822
1.025250501002 66.542596723352
0.965137625757755 67.0060120240481
0.918637274549098 67.4204409625321
0.998597194388777 67.8320391229307
0.945290581162325 68.3528446470821
1.0062124248497 68.7585657656635
0.983473403102848 69.1663326653307
0.930060120240481 69.5734621221638
1.025250501002 70.0026332423529
0.964328657314629 70.5036466591349
1.02905811623246 70.9119996052883
0.998597194388777 71.3244133220797
0.945290581162325 71.8067087453569
1.025250501002 72.2728673401644
0.966964050046812 72.7014028056112
0.930060120240481 73.1319492923244
1.00240480961924 73.57386744428
0.956713426853707 73.989189023912
1.04428857715431 74.4381476654227
0.984300126959534 74.8617234468938
0.949098196392785 75.2883035415837
1.025250501002 75.7320699987814
0.964672993174945 76.2364729458918
1.04428857715431 76.7061687754459
0.983972589246051 77.2184368737475
0.930060120240481 77.627516657321
1.00240693023471 78.2004008016032
0.945290581162325 78.6857290677175
1.02548291384415 79.1823647294589
0.964328657314629 79.7148697174807
1.03667334669339 80.123373509922
0.987195761749882 80.5571142284569
0.949098196392785 80.9639210567045
1.025250501002 81.429398409286
0.965786880872181 81.9318637274549
1.025250501002 82.3895310195515
0.98442989663804 82.9138276553106
0.941482965931864 83.3188627986257
1.00240480961924 83.7303630542135
0.964485191796694 84.2885771543086
1.025250501002 84.7090756409256
0.964359826110867 85.2705410821643
1.04428857715431 85.6828053422345
0.98357180830001 86.25250501002
0.930060120240481 86.6572295518191
1.00240480961924 87.1682018727355
0.964328657314629 87.6081772451371
1.02822204218389 88.0200400801603
0.983366733466934 88.5337914136343
0.92625250501002 88.9887042646511
1.00436564950659 89.3947895791583
0.964328657314629 89.8918556192766
1.025250501002 90.3758767108971
0.983366733466934 90.8766398920704
1.0062124248497 91.3159283128163
1.002406558182 91.751503006012
0.964328657314629 92.2081027714669
1.025250501002 92.6645809488758
0.983366733466934 93.107851449935
0.92955298696769 93.5190380761523
1.00240480961924 94.0244291312831
0.964328657314629 94.4684826831915
1.02616623567068 94.8937875751503
0.983366733466934 95.3921717455547
1.0062124248497 95.821513021288
1.00338111149972 96.2685370741483
0.964328657314629 96.7355130914092
1.02537777092241 97.250501002004
0.983366733466934 97.7172249714305
0.987174348697395 98.1497815974063
1.00283975011769 98.625250501002
0.964328657314629 99.0741887073207
1.025250501002 99.5732526132204
0.983876700342624 100
0 5
0.754711301301035 6.12424849699399
0 13
1.92927214249325 6.32064128256513
0 9
0.805938446698719 11.8196392785571
0 5
1.24846420122134 17.7114228456914
0 17
1.20225497758016 18.8897795591182
0 5
0.904037401509304 26.5490981963928
0 11
1.18482308523358 30.0841683366733
0 5
0.888032089838607 32.2444889779559
0 9
1.12149227697163 42.6533066132264
0 7
1.13918311806814 42.6533066132264
0 9
0.940492199535513 75.2545090180361