# Generate Fmbalbuena Numbers

My user id is 106959

How to check if the number is Fmbalbuena number?

First Step: Check if the number of digits is a multiple of 3: 6 = 3 * 2

Second step: Split the digits into even thirds: 106959 -> 10 69 59

Third step: Subtract the first set of digits from the second modulo 10: 6 - 1 = 5, 9 - 0 = 9

Last step: Check that the result is the same as the third set of digits: 59 = 59

## Sequence

Here is the sequence until 106959

109, 110, 121, 132, 143, 154, 165, 176, 187, 198, 208, 219, 220, 231, 242, 253, 264, 275, 286, 297, 307, 318, 329, 330, 341, 352, 363, 374, 385, 396, 406, 417, 428, 439, 440, 451, 462, 473, 484, 495, 505, 516, 527, 538, 549, 550, 561, 572, 583, 594, 604, 615, 626, 637, 648, 659, 660, 671, 682, 693, 703, 714, 725, 736, 747, 758, 769, 770, 781, 792, 802, 813, 824, 835, 846, 857, 868, 879, 880, 891, 901, 912, 923, 934, 945, 956, 967, 978, 989, 990, 100090, 100191, 100292, 100393, 100494, 100595, 100696, 100797, 100898, 100999, 101000, 101101, 101202, 101303, 101404, 101505, 101606, 101707, 101808, 101909, 102010, 102111, 102212, 102313, 102414, 102515, 102616, 102717, 102818, 102919, 103020, 103121, 103222, 103323, 103424, 103525, 103626, 103727, 103828, 103929, 104030, 104131, 104232, 104333, 104434, 104535, 104636, 104737, 104838, 104939, 105040, 105141, 105242, 105343, 105444, 105545, 105646, 105747, 105848, 105949, 106050, 106151, 106252, 106353, 106454, 106555, 106656, 106757, 106858, 106959


You can generate the first N numbers, infinite numbers, Check if the number is Fmbalbuena number or get Nth number of the sequence

## Test cases

Truthy

106959
109
219
103222
666666000
777666999


Falsy

100
230
320
666666666
125466
1069592


# 05AB1E, 14 13 bytes

Checks if a given number is a Fmbalbuena:

S3äR-T%Q*g3Ö


Could be 12 bytes by taking the input as a list of digits, removing the leading S.

We can add a leading ∞ʒD to output the infinite sequence:
Try it online.

Explanation:

S          # Split the (implicit) input-integer to a list of digits
3ä        # (Try to) split it into three equal-sized parts
R       # Reverse these parts from [A,B,C] to [C,B,A]
# Pop and push all three lists separated to the stack
-     # Subtract the digits of the top two lists: B-A
T%   # Modulo-10
Q  # Check if it's equal to C: B-A=C (1 if truthy; 0 if falsey)
*          # Multiply this by the (implicit) input-integer
# (remains unchanged if the check was truthy or becomes 0 otherwise)
g         # Pop and push its length
3Ö       # Check if this is divisible by 3
# (after which it is output implicitly as result)

∞          # Push an infinite positive list: [1,2,3,...]
ʒ         # Filter it by:
D        #  Duplicate the current integer
S3äR-T%Q*g3Ö
#  Same as above
# (after which the filtered infinite list is output implicitly as result)

• Test cases are added, can you change the test cases? Jan 13 at 12:07
• @Fmbalbuena Done, although one of your test cases is incorrect. Jan 13 at 12:25
• Edited a test case Jan 13 at 16:37

# Charcoal, 27 bytes

¬∨﹪Ｌθ³⊙∕θ³﹪⍘⭆³§§⪪θ÷Ｌθ³λκ±¹χ


Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, i.e. - if the input is an Fmbalbuena number, nothing if not. Explanation:

    θ                       Input as a string
Ｌ                        Length
﹪  ³                      Is not divisible by 3
∨                          Logical Or
θ                   Input as a string
∕ ³                  Reduced to a third in length
⊙                     Any index satisfies
³              Literal integer 3
⭆               Map over implicit range and join
θ          Input string
⪪ ÷Ｌθ³      Split into three parts
§            Indexed by
λ     Inner value
§             Indexed by
κ    Outer index
⍘            ±¹  Interpreted as base -1
﹪               χ Is not divisible by 10
¬                           Logical Not
Implicitly print

• 666777999 must give - because 6 - 7 gives -1 and mod by 10 gives 9 Jan 13 at 12:29
• @Fmbalbuena Then it wouldn't work for your user id, because 0 - 9 gives -9 and mod by 10 gives 1.
– Neil
Jan 13 at 13:53

# JavaScript (ES6), 66 bytes

Expects the input number as a string. Returns a Boolean value.

n=>![...n].some((d,i)=>i<(l=n.length/3)&(n[i+=l]-d+10)%10!=n[i+l])


Try it online!

### How?

We don't explicitly test whether the length of the input number is a multiple of 3. When it's not, l is a non-integer value, both n[i+l] and n[i+2*l] are undefined, n[i+l]-d+10 is NaN, and we end up testing NaN != undefined, which is true and makes the test fail as expected.

# Factor + grouping.extras, 75 45 bytes

[ 3 n-group first3 spin v- [ 10 rem ] map = ]


Returns whether or not the input is a Fmbalbuena number.

## Explanation

                   ! { 1 0 6 9 5 9 }
3 n-group          ! { { 1 0 } { 6 9 } { 5 9 } }
first3             ! { 1 0 } { 6 9 } { 5 9 }
spin               ! { 5 9 } { 6 9 } { 1 0 }
v-                 ! { 5 9 } { 5 9 }
[ 10 rem ] map     ! { 5 9 } { 5 9 }
=                  ! t


# Jelly, 14 bytes

Dœs3µZI%⁵z-Ḣ⁼Ṫ


A monadic Link accepting a positive integer that yields 1 if it is Fmbalbuena, or 0 if not.

Try it online!
Or test every positive integer up to and including $$\106959\$$ here.

### How?

Dœs3µZI%⁵z-Ḣ⁼Ṫ - Link: positive integer, I
D              - digits of I
3           - literal three
œs            - split the digits into three equal(ish) parts
(if not equally splittable leftmost get longer first)
µ          - start a new monadic chain with X=that as the argument
Ṫ - tail X (gets the digits in the last part and modifies X)
Z         - transpose the remaining parts
I        - deltas
⁵      - literal ten
%       - modulo (the deltas)
-    - literal minus one
z     - transpose with filler -1 (avoiding false positives like 1009)
⁼  - does that equal the tail we removed?


# R, 65 bytes

function(x,y=matrix(x,,3))!any((y[,2]-y[,1])%%10-y[,3],sum(x,-y))


Try it online!

Input as list of digits; checks whether this is a 'Fmalbuena' number.
+24 bytes for input as integer.

Pretty straightforward, except that we can check whether length of x is divisible by 3 using sum(x,-y) instead of length(x)%%3 (or its usual R golf sum(x|1)%%3), since we know that all elements of x must be non-negative, and the first one must be positive.

# Brachylog, 139 8 bytes

ḍ₃\-ᵐtᵛ0


Not sure how I missed that by making it about congruence to 0, I dodged any thorny sign issues in taking the last digit versus performing a proper mod 10.

ḍ₃          Split the input into three digit lists of similar lengths.
\         Check that the lengths are strictly equal, and transpose.
ᵐ       For each triple,
-        subtract the second digit from the sum of the first and third.
tᵛ0    Is the last digit of every difference 0?

• Finally ᵛ is useful for something! Jan 14 at 15:02
• @Fatalize I haven't been too active with Brachylog lately, but ᵛ has always felt pretty useful to me--granted, a lot of the time it ends up being ≡ᵛ, which can usually be equivalent to =h. I'd say the real standout here is how - generalizes to longer lists: it seems like it should broadly be the more useful behavior than, say, reducing by subtraction, but I can't say I remember the last time it actually came up. Jan 14 at 16:59

# Vyxal, 19 14 bytes

L3/₌ẎȯI÷‟-ȧ₀%⁼


Try it Online!

Checks whether an input number is a Fmbalbuena number. Takes input as a list of digits.

can't believe I forgot to handle the case where the length isn't divisible by 3...

-5 thanks to Fmbalbuena

## Explained

L3/₌ẎȯI÷‟-ȧ₀%⁼
L                   # Push the length of the input
3/                 # divide that by 3
₌Ẏȯ              # and push input[0:that], input[that:-1]
I             # split input[that:-1] into two lists
÷            # and dump that onto the stack - the stack is now [first N/3, remaining first half, remaining second half]
‟           # rotate the stack right - this sets it up for the subtraction
-ȧ         # subtract the first N/3 digits from the second half and take the absolute value
₀%       # and modulo by 10
⁼      # does that exactly equal the first half?

• The input must be a number Jan 13 at 11:56
• @Fmbalbuena no it doesn't Jan 13 at 11:57
• just kidding, explain? Jan 13 at 11:57
• I'm working on that right now lol Jan 13 at 11:57
• @Fmbalbuena I just need a second to change the explanation lol Jan 13 at 12:18

# J, 64 bytes

Check whether a number is Fmbalbuena. The input is a number as a string, for example '219'. Yield 1 if the number is Fmbalbuena, 0 otherwise.

([:>(2{])((9|~[)=9|~])&.>(1{])-&.>0{])(]$~3,3%~#)".&.>(#$1<;.1])

(#$1<;.1]) split into digits (characters) ".&.> convert digits into real digits (]$~3,3%~#) reshape into thirds
([:>(2{])((9|~[)=9|~])&.>(1{])-&.>0{]) substract modulo 9 and check for equality
`

It can probably golfed a lot more but I am helpless when it comes to performing operations on cells.